﻿//import hu8.libs.js
//import hu8.log.js
//import hu8.box.js
//import /languages/zh.js
/**
* This file depended on jQuery, some attributes passed from the server end and a language file
* 
* @author: Jackie Liu
*
* The file manager can be called from another page, the page has the option to have a "page_type" js variable, 
* which is used to identify what kind of page the caller is. e.g. the file manager is initialised from the FCKeditor,
* then the code in this file would know how to deal with it. (how to display, what kind of functionalities to show, ect）
**/

var parent_type = "";
var paixutype = "CREATE_TIME";//文件排序类型
 
function test() {
    //filemanager.load_contents(this.RelativePath, true);
    //alert("dd");
}
var g_selected_file_id;
function openfile(obj) {
    obj = $(obj);
    obj = obj.parent().parent();
    filemanager.previewfile(obj.attr("path"), obj.attr("rel"));
    //alert($(obj));
}
function download_file(obj) {
    obj = $(obj);
    obj = obj.parent().parent();
    var path = obj.attr("path");
    
    filemanager.downloadByClick(path);
    //filemanager.download(true);
}

function EditSourceFile(obj) {
    obj = $(obj);
    obj = obj.parent().parent();
    var relativePath = obj.attr("path");
    var name = obj.attr("rel");
    //alert(name);
    var spaceType = $("#hiddenType_Name_IsAdmin").val();
    //alert(spaceType);
    if (spaceType) {
        spaceType = spaceType.split('|');
        if (spaceType[0] == "project") {
            spaceType = spaceType[0];
        }
    }
    if (!spaceType) {
        spaceType = "individual";
    }
    var Team_ID = "";
    var spacetypes = new Array();
    spaceType = "'" + spaceType + "'";
    spacetypes = spaceType.split(",");

    if (spacetypes.length >= 3) {
        Team_ID = spacetypes[1];
    }
    var DiskPath = "D:/TaDongDoc/";

    var RequestPath = relativePath.replace(DiskPath, "");
    RequestPath = RequestPath.replace("/" + name, "");

    var user_id = getCookie('_userId_');

    if (spacetypes[0] == "'individual") {
        box.open_window(lang.SPACE_Space_modify_metadata, fe_url + "/DataSubmit/EditSourceFiles2.aspx?path=" + RequestPath + "&filename=" + name + "&spacetype=individual", 760, 520, true);
    }
    if (spacetypes[0] == "'group") {
        box.open_window(lang.SPACE_Space_modify_metadata, fe_url + "/DataSubmit/EditSourceFiles2.aspx?path=" + RequestPath + "&filename=" + name + "&spacetype=" + spaceType + "", 760, 520, true);
    }
    if (spacetypes[0] == "'project'") {
        box.open_window(lang.SPACE_Space_modify_metadata, fe_url + "/DataSubmit/EditSourceFiles2.aspx?path=" + RequestPath + "&filename=" + name + "&spacetype=project", 760, 520, true);
    }
}
function submitFile(obj) {
    filemanager.submitfile(filemanager.get_selected(), filemanager.get_selected_name());
}


function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=")
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1
            c_end = document.cookie.indexOf(";", c_start)
            if (c_end == -1) c_end = document.cookie.length
            return unescape(document.cookie.substring(c_start, c_end))
        }
    }
    return ""
}

function file_copy() {
    filemanager.relocate(false, "wj");
}
//文件移动
function file_move() {
    filemanager.relocate(true, "wj");
}
//文件夹移动
function folder_move() {
    filemanager.relocate(true, "wjj");
}
//文件删除
function file_remove() {
    filemanager.remove(true, "wj");
}

//文件夹删除
function folder_remove() {
    filemanager.remove(true, "wjj");
}
//文件重命名
function file_rename() {
    
    filemanager.rename(filemanager.get_selected(), filemanager.get_selected_name(), 'wj');
    //filemanager.remove(true, "wj");
}
//文件夹重命名
function folder_rename() {
    filemanager.rename(filemanager.get_selected(), filemanager.get_selected_folderName(), 'wjj');
    // filemanager.remove(true, "wjj");
}
//文件共享
function file_share() {
    filemanager.sharefile(filemanager.get_selected(), filemanager.get_selected_name());
}


$(function () {
    parent_type = window.parent.page_type;
    if (parent_type) {
        log.log_text(lang.From_the + parent_type + lang.open);
    }

    $(":wijmo-wijdialog").wijdialog("destroy").remove();
    filemanager.init(); //Initialise the file manager 初始化文件管理器

    /***************************** 按钮事件绑定 BUTTON EVENT BINDING *****************************/
    $(".fm-language-select-box").live("change", function () {
        var lang = $(this).val();
        window.location = "?lang=" + lang;
    });


    //Loading infomation 加载信息
    $(".cmd-loadinfo").live("click", function () {
        var dir = $(this).attr("rel");
        var is_dir = $(this).hasClass("dir");
        var title = $(this).text();
        filemanager.load_info(title, is_dir, dir);
    });

    $(".cmd-copy").live("click", function () {
        filemanager.relocate(false, "");
    });
    $(".cmd-cut").live("click", function () {
        filemanager.relocate(true, "");
    });
    $(".cmd-extract").live("click", function () {
        filemanager.extract(true);
    });
    $(".cmd-compress").live("click", function () {
        filemanager.compress(true);
    });
    $(".cmd-delete").live("click", function () {
        filemanager.remove("", true);
    });
    $(".cmd-download").live("click", function () {
        filemanager.download(true);
    });
    $(".cmd-upload").live("click", function () {
        filemanager.upload(true);
    });
    $(".cmd-newfile").live("click", function () {
        filemanager.newfile(true);
    });
    $(".cmd-about").live("click", function () {
        var title = $(this).text();
        var path = $(this).attr("href");
        box.open_window(title, path, 400, 300);
        return false;
    });
    //open the config window
    $(".cmd-config").live("click", function () {
        var title = $(this).text();
        var path = $(this).attr("href");
        box.open_window(title, path, 400, 300);
        return false;
    });
    $(".cmd-newdirectory").live("click", function () {
        filemanager.newdirectory(true);
    });
    $(".cmd-change-mode").live("click", function () {
        var mode = $(this).attr("rel");
        filemanager.mode = mode;
        filemanager.reload();
        filemanager.init_mode();
    });
    /*******************************************************************/



    //导航
    $(".cmd-selectall").live("click", function () {
        //    $("#directory-content-list .row").addClass("ui-selected");
    });
    $(".cmd-reload").live("click", function () {
        filemanager.reload(true);
    });
    $(".cmd-home").live("click", function () {
        filemanager.load_contents("~/", true);
    });

    //上一级目录
    $(".cmd-uponelevel").live("click", function () {
        filemanager.uponelevel();
    });
    $(".cmd-uponelevel-dot").live("dblclick", function () {
        filemanager.uponelevel();
    });

    $(".cmd-back").live("click", function () {
        filemanager.back();
    });

    $(".cmd-forward").live("click", function () {
        filemanager.forward();
    });

    $(".cmd-jump").live("click", function () {
        var path = "~/" + $(".fe-current-path").val();
        filemanager.load_contents(path, true);
    });

    $(".fe-editfile").live("click", function () {
        var link = $(this).attr("rel");
        filemanager.editfile(link, true);
    });

    //dblclick  mousedown dblclick
    $(".dir").live("mousedown", function (e) {
        
        if (e.which != 1)
            return;
        var path = $(this).attr("rel");
        document.getElementById("hidFolderID").value = path;

        if (path) {
            filemanager.load_contents(path, true);

        }

    });

    //点击搜索按钮搜索文件和文件夹
    $("#btnSearch").live("click", function () {
        //获取文本框值
        var txtOjb = $(".fe-search");
        //转化成小写
        var keyword = $(txtOjb).val().toLowerCase();
        var path = filemanager.get_path(); //document.getElementById("hidFolderID").value;

        if (path) {
            filemanager.load_contentsbysearch(path, keyword, true);
        }
        else {
            path = 0;
            filemanager.load_contentsbysearch(path, keyword, true);
        }

    });

    //非机构化搜索path：文件夹ID，keyword：输入搜索关键词
    filemanager.load_contentsbysearch = function (path, keyword, is_click) {
        
        document.getElementById("hidType").value = "";
        var url = "GetFolder";
        var url1 = "GetFolder";
        var FileType;
        var attr = "{ path:'" + path + "'}";
        document.getElementById("hidpath").value = path;
        var spaceType = $("#hiddenType_Name_IsAdmin").val();
        if (spaceType) {
            spaceType = spaceType.split('|');

            if (spaceType[0] == "project") {
                if (!isPag) {
                    g_path = path;
                }
                else {
                    path = g_path;
                }
                parentFolderId = filemanager.get_selected_parentId();

                url = "GetFolderFromDBAndKeyWord";
                is_click = false;
                if (!g_pageNum || !g_pageSize) {
                    g_pageNum = 1;
                    g_pageSize = 20;
                }
                attr = "{ path:'" + path + "',keyword:'" + keyword + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + ",FileType:'XMK',ID:'" + spaceType[1] + "'}";
                url1 = "GetNavigate";
            }
            if (spaceType[0] == "individual") {
                if (!isPag) {
                    g_path = path;
                }
                else {
                    path = g_path;
                }

                parentFolderId = filemanager.get_selected_parentId();
                url = "GetFolderFromDBAndKeyWord";
                is_click = false;
                if (!g_pageNum || !g_pageSize) {
                    g_pageNum = 1;
                    g_pageSize = 20;
                }
                attr = "{ path:'" + path + "',keyword:'" + keyword + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + ",FileType:'PERSON',ID:'" + spaceType[1] + "'}";
                url1 = "GetNavigate";
            }
            if (spaceType[0] == "group") {
                //alert("课题组");
                if (!isPag) {
                    g_path = path;
                }
                else {
                    path = g_path;
                }
                parentFolderId = filemanager.get_selected_parentId();
                url = "GetFolderFromDBAndKeyWord";
                is_click = false;
                if (!g_pageNum || !g_pageSize) {
                    g_pageNum = 1;
                    g_pageSize = 20;
                }
                attr = "{ path:'" + path + "',keyword:'" + keyword + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + ",FileType:'TEAM',ID:'" + spaceType[1] + "'}";
                url1 = "GetNavigate";
            }

        }
        // 请求当前的站点导航
        filemanager.post(url1, attr, is_click, function (d) {
            document.getElementById("hidType").value = "";
            //获取返回的字符串，包括文件夹名称和文件夹ID
            var Navigate = d.d;
            document.getElementById("txtNavigate").value = Navigate;
            var lblNavigates = $("#txtNavigate").val();
            //alert(lblNavigates);
            var naviagte = new Array();
            naviagte = lblNavigates.split(":");

            var list = "&nbsp;&nbsp;<a href='#' rel=0 class='top_nav'  />" + lang.SPACE_Root_directory + " > "; //" 根目录 > ";
            //        alert(naviagte);
            for (i = 0; i < naviagte.length; i++) {
                if (i % 2 == 0) {
                    //                alert(naviagte[i]);
                    //                alert(naviagte[i + 1]);
                    list += "<a href='#' rel='" + naviagte[i + 1] + "' class='top_nav'  />" + naviagte[i] + " > ";

                }

            }
            list = list.substring(0, list.length - 2);
            //        alert(list);
            document.getElementById('divNavigate').innerHTML = list;

            $(".top_nav").click(function () {

                //filemanager.load_contents(naviagte[i + 1], true);

                filemanager.load_contents($(this).attr("rel"), true)
            });


        });

        filemanager.post(url, attr, is_click, function (d) {

            var folder = new Folder(d.d);
            if (!folder.hasError()) {
                var html = "";
                if (filemanager.mode == "table") {
                    html = folder.generateTable();
                } else if (filemanager.mode == "thumb") {
                    html = folder.generateThumbList();
                }

                //$(".content-list").html(html);
                $(".content-list")[0].innerHTML = html;
                $(".directory-content").chromatable({
                    width: "100%", height: $("#divid").height() * 0.95 + "px",
                    scrolling: "yes"
                });

                $(".fe-folder-info").html(folder.getMiniInfo());
                var i = 0;
                $('.nav').each(function () {

                    //  stuHover($(this));
                    //  $('.jsddm > li').bind('mouseover', jsddm_open);
                    // $('.jsddm > li').bind('mouseout', jsddm_timer);
                    //$(this).superfish({
                    //add options here if required
                    //	});
                    //add options here if required
                });



                //历史记录
                var current_history = filemanager.history[filemanager.current_position];

                if (((current_history != null && path != filemanager.history[filemanager.current_position].getPath()) || current_history == null)) {
                    filemanager.current_position++;
                    filemanager.history[filemanager.current_position] = folder;
                }
                $(".fe-current-path").val(folder.getPath());
                $('#pag').pagination({ total: d.d.FileCount });
                if (g_sSpaceType == "project") {
                    //$('#pag').pagination({ total: d.d.FileCount });
                    $("#hfCurrentPath").val(path);
                }
                else {
                    $("#hfCurrentPath").val(folder.getRelativePath());
                    //$('#pag').pagination({ total: d.d.FileCount });
                }

                //记录浏览记录到 log record browse history to log
                log.log_text(lang.browse_history + folder.getRelativePath());

                //加载多选器 initialise the multi-select
                // filemanager.init_select();
                $("#directory-content-list tr").click(function () {

                    $("#directory-content-list tr").each(function () {
                        $(this).removeClass("click_mode");
                        $(this).find("div").css('visibility', 'hidden');
                    });
                    $(this).addClass("click_mode");
                    $(this).find("div").css('visibility', 'visible')
                    g_selected_file_id = $(this).attr("path");

                });
                //加载文件夹右键菜单 initialise the right click menu
                var dir_menu = [];
                //            var dm_1 = {};
                //            dm_1[lang.open] = function (menuItem, menu) { filemanager.load_contents($(this).attr("path"), true); };
                //            if ($("#hidden_identity").val() != "visit") {
                //                dm_1[lang.download] = function (menuItem, menu) { filemanager.download($(this).attr("path")); };
                //            }
                //              dir_menu.push(dm_1);
                //------复制、移动-------------------------------------------
                //dir_menu.push($.contextMenu.separator);
                var dm_2 = {};
                dm_2[lang.move] = function (menuItem, menu) { filemanager.relocate(true, "wjj"); };
                // dm_2[lang.copy] = function (menuItem, menu) { filemanager.relocate(false,"wjj"); };

                //-----删除、重命名-------------------------------------------
                dir_menu.push($.contextMenu.separator);
                var dm_3 = {};
                dm_3[lang.del] = function (menuItem, menu) { filemanager.remove(true, "wjj"); };
                dm_3[lang.rename] = function (menuItem, menu) { filemanager.rename($(this).attr("path"), $(this).attr("rel"), 'wjj'); };
                //-------------------------------------------------
                //              dir_menu.push($.contextMenu.separator);
                //              var dm_4 = {};
                //              dm_4[lang.compress] = function (menuItem, menu) { filemanager.compress(); };
                //              dm_4[lang.rename] = function (menuItem, menu) { filemanager.rename($(this).attr("path"), $(this).attr("rel")); };

                //-------------------------------------------------
                //               dir_menu.push($.contextMenu.separator);
                //               var dm_5 = {};
                //               dm_5[lang.new_file] = function (menuItem, menu) { $(".cmd-newfile").click(); };
                //               dm_5[lang.new_folder] = function (menuItem, menu) { $(".cmd-newdirectory").click(); };
                //               dm_5[lang.view_property] = function (menuItem, menu) { filemanager.load_folder($(this).attr("path")); };

                //            if ($("#hidden_identity").val() != "visit") {
                dir_menu.push(dm_2);
                dir_menu.push(dm_3);
                //dir_menu.push(dm_4);
                // dir_menu.push(dm_5);
                //            }

                //加载文件右键菜单
                var file_menu = new Array;
                var fm_1 = {};
                var fm_4 = {};


                if (parent_type == "THEME_ENGINE") {
                    fm_1[lang.edit] = function (menuItem, menu) {
                        var full_path = $(this).attr("path").replace("~/", file_base_url);
                        parent.pe.insert_image(full_path);
                    }; //从页面引擎呼叫
                }
                //----------右键弹出对话框功能-----------------
                //fm_1[lang.edit] = function (menuItem, menu) { filemanager.editfile($(this).attr("path")); };
                if ($("#hidden_identity").val() != "visit" && g_sSpaceType != "project" && g_isDataManage == false) {
                    fm_1[lang.share] = function (menuItem, menu) { filemanager.sharefile($(this).attr("path"), $(this).attr("rel")); };
                    fm_1[lang.submit] = function (menuItem, menu) { filemanager.submitfile($(this).attr("path"), $(this).attr("rel")); };

                    //  fm_4[lang.new_file] = function (menuItem, menu) { $(".cmd-newfile").click(); };
                    fm_4[lang.new_folder] = function (menuItem, menu) { $(".cmd-newdirectory").click(); };
                }
                fm_4[lang.view_property] = function (menuItem, menu) { filemanager.load_file($(this).attr("path")); };

                fm_1[lang.preview] = function (menuItem, menu) { filemanager.previewfile($(this).attr("path"), $(this).attr("rel")); };
                fm_1[lang.download] = function (menuItem, menu) { filemanager.download($(this).attr("path")); };
                file_menu.push(fm_1);
                file_menu.push($.contextMenu.separator);
                //-------------------------------------------------
                var fm_2 = {};
                fm_2[lang.move] = function (menuItem, menu) { filemanager.relocate(true, "wj"); };
                fm_2[lang.copy] = function (menuItem, menu) { filemanager.relocate(false, "wj"); };

                //-------------------------------------------------
                var fm_3 = {};
                fm_3[lang.del] = function (menuItem, menu) { filemanager.remove(true, "wj"); };
                fm_3[lang.rename] = function (menuItem, menu) { filemanager.rename($(this).attr("path"), $(this).attr("rel"), 'wj'); };

                //-------------------------------------------------


                if ($("#hidden_identity").val() != "visit") {

                    file_menu.push(fm_2);
                    file_menu.push($.contextMenu.separator);
                    file_menu.push(fm_3);
                    file_menu.push($.contextMenu.separator);
                    file_menu.push(fm_4);
                }

                //if (g_sSpaceType == "project") {
                //   $(".fe-dir").contextMenu(dir_menu, { theme: 'vista' });
                //}

                //   $(".fe-file").contextMenu(file_menu, { theme: 'vista' });
            } else {
                box.error(folder.getError());
            }
        });
    }






    //    $(".fe-dir").dblclick( function () {
    //        alert('sss');
    //        var path = $(this);
    //    });
    //    $(".dir").each(function (_, element) {
    //        $(element).click(function () {
    //            alert('haha');
    //        });
    //    });

    //右键按钮
    //    $(".row").live("mousedown", function (e) {
    //        if (e.which == 3) {
    //            filemanager.select_one($(this).attr("path"));
    //        }
    //    });
    var time_last = null;
    $(".fe-dir .fe-thumb").live("mousedown", function (e) {
        if (time_last == null) {
            time_last = new Date().getTime();
            return;
        }
        time_now = new Date().getTime();
        if (time_now - time_last < 300) {
            var path = $(this).parent().attr("path");
            filemanager.load_contents(path, true);
        }
        time_last = new Date().getTime();
        //        if (e.which == 3) {
        //            filemanager.select_one($(this).attr("path"));
        //        }

    });
});

//加载文件或者文件夹信息
var filemanager = {};
filemanager.ajax_lock = false;
filemanager.mode = "table"; //table/thumb
filemanager.history = new Array;
filemanager.current_position = -1;
filemanager.base_url = fe_url + "/WebServices/FileService.asmx/";
filemanager.base_thumb_url = fe_url + "/Thumb/";
filemanager.get_url = function (url) {
    url = filemanager.base_url + url;
    return url;
}


//基础
filemanager.post = function (url, attrs, is_click, action) {
    url = filemanager.get_url(url);
    if (is_click) { //如果是手动点击的话，则有锁定功能
        if (!filemanager.ajax_lock) {
            filemanager.ajax_lock = true;
            filemanager.ajax_post(url, attrs, action);
        } else {
            log.log_text(lang.tips_wait_for_previous_request, true);
        }
    } else {
        filemanager.ajax_post(url, attrs, action);
    }
}

filemanager.ajax_post = function (url, attrs, action) {
    $.ajax({
        url: url,
        type: "POST",
        data: attrs,
        async: true,
        contentType: 'application/json; charset=utf-8',
        //dataType: 'json',
        success: action,
        complete: function () {
            filemanager.ajax_lock = false;
            log.log_text(lang.tips_request_completed, false);
        }
    });
}

filemanager.get = function (url, attrs, action) {
    url = filemanager.get_url(url);
    $.ajax({
        url: url,
        type: "GET",
        data: attrs,
        async: true,
        contentType: 'application/json; charset=utf-8',
        //dataType: 'json',
        success: action
    });
}

/****************************************************************************************************************************/
filemanager.init = function () {
    filemanager.load_contents(filemanager.get_path(), true);
    filemanager.init_mode();
}

filemanager.init_mode = function () {
    $(".cmd-change-mode").show();
    $(".cmd-change-mode[rel='" + filemanager.mode + "']").hide();
}

filemanager.reload = function () {
    filemanager.load_contents(filemanager.get_path(), false);
}

//获取当前路径 Get the current path value
filemanager.get_path = function () {
    var current_path = $("#hfCurrentPath").val();
    return current_path;
}

//加载文件或文件夹信息 Load file/folder information
filemanager.load_info = function (title, is_dir, dir, is_click) {
    var attr = "{ path:'" + dir + "'}";
    if (is_dir) {
        filemanager.post("GetFolder", attrs, is_click, function (obj) {
            box.open(title, obj, true);
        });
    } else {
        filemanager.post("GetFile", attrs, is_click, function (obj) {
            box.open(title, obj, true);
        });
    }
}

//获取选中的文件以及文件夹 Get selected files and folders
filemanager.get_selected = function () {
    var files = "";

    $("#directory-content-list  tr").each(function () {
        //if ($(this).is(":hover"))
        if ($(this).attr("class").indexOf("click_mode") > 0)
        { files += $(this).attr("path") + ","; }
    });

    files = files.removeLastChar();
    return files;
}
//获得当前选中行的文件名
filemanager.get_selected_name = function () {
    var files = "";
    $(".fe-file.row :checkbox:checked").each(function () { files = $(this).parent().parent().attr("rel") })
    return files;
}
//获得当前选中行的文件夹名
filemanager.get_selected_folderName = function () {
    var files = "";
    $("#directory-content-list  tr").each(function () {
        // if ($(this).is(":hover"))
        if ($(this).attr("class").indexOf("click_mode") > 0)
        { files += $(this).attr("rel") + ","; }
    });

    files = files.removeLastChar();
    return files;
}


//项目库空间 返回父节点ID
filemanager.get_selected_parentId = function () {
    var files = "";
    $("#directory-content-list .ui-selected").each(function () {
        files += $(this).attr("attribute") + ",";
    });
    files = files.removeLastChar();
    //alert(files);
    return files;
}

filemanager.get_selected_list = function () {
    var files = "";
    //    $("#directory-content-list .ui-selected").each(function () {
    //        files += $(this).attr("rel") + "<br/>";
    //    });
    files = g_selected_file_id;

    return files;
}

filemanager.get_selected_count = function () {//d0dafd
    // return $("#directory-content-list .ui-selected").size();



    var i = 0;
    //    $("#directory-content-list  tr").each(function () {
    //        if ($(this).is(":hover"))
    //        { i++; }
    //    });

    if (g_selected_file_id)
        i = 1;

    return i; // $("#directory-content-list   tr [background=#d0dafd] ").size();
}




/****************************************************************************************************************************/

//加载课题组查看共享文件夹列表
filemanager.load_shareView = function (groupName, is_click) {

    document.getElementById("hidType").value = "teamShareView";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "user") {
        sortDesc = document.getElementById("hideSortUserDesc").value;
    }

    var attr = "{ groupName:'" + groupName + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";

   

    filemanager.post("GetShareView", attr, true, function (d) {
        var html = generateShareTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });

        filemanager.init_select();
    });
}
//加载项目库查看共享文件夹列表
filemanager.load_shareXmkShare = function (is_click) {
    document.getElementById("hidType").value = "xmkShareView";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "user") {
        sortDesc = document.getElementById("hideSortUserDesc").value;
    }
    var attr = "{ pageNum:" + g_pageNum + ",sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',size:" + g_pageSize + "}";

    filemanager.post("GetXmkShareView", attr, true, function (d) {
        var html = generateXmkShareTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });
        filemanager.init_select();



    });
}
//空间提交共享项排序
function sort(sorttype) {
    var type = document.getElementById("hidType").value;
    document.getElementById("hideSortType").value = sorttype;
    var user_id = getCookie('_userId_');
    var spaceType = $("#hiddenType_Name_IsAdmin").val();
    if (spaceType) {
        spaceType = spaceType.split('|');
    }
    if (sorttype == "time") {
        var sorttime = document.getElementById("hideSortTimeDesc").value;
        if (sorttime == "desc") {
            document.getElementById("hideSortTimeDesc").value = "asc";
        }
        else {
            document.getElementById("hideSortTimeDesc").value = "desc";
        }
    }
    if (sorttype == "space") {
        var sorttime = document.getElementById("hideSortSpaceDesc").value;
        if (sorttime == "desc") {
            document.getElementById("hideSortSpaceDesc").value = "asc";
        }
        else {
            document.getElementById("hideSortSpaceDesc").value = "desc";
        }
    }
    if (sorttype == "size") {
        var sorttime = document.getElementById("hideSortSizeDesc").value;
        if (sorttime == "desc") {
            document.getElementById("hideSortSizeDesc").value = "asc";
        }
        else {
            document.getElementById("hideSortSizeDesc").value = "desc";
        }
    }
    if (sorttype == "user") {
        var sorttime = document.getElementById("hideSortUserDesc").value;
        if (sorttime == "desc") {
            document.getElementById("hideSortUserDesc").value = "asc";
        }
        else {
            document.getElementById("hideSortUserDesc").value = "desc";
        }
    }
    
    if (type == "perMySubmit") {
        filemanager.load_MySubmitData(user_id);
    }
    else if (type == "MyBackData") {
        filemanager.load_MyBackData(user_id);
    }
    else if (type == "shareMyView") {
        filemanager.load_shareMyView(user_id);
    }
    else if (type == "RecycleData") {
        filemanager.load_RecycleData(user_id);
    }

    else if (type == "teamMySubmit") {
        var teamId = $(this).attr("content");
        filemanager.load_TeamMySubmitData(spaceType[1]);
    }
    else if (type == "teamMyBackData") {
        filemanager.load_TeamMyBackData(spaceType[1]);
    }
    else if (type == "teamShareView") {
        var teamId = $(this).attr("content");
        filemanager.load_shareView(spaceType[1]);
    }
    else if (type == "teamUnauditedData") {
        var teamId = $(this).attr("content");
        filemanager.load_UnauditedData(spaceType[1]);
    }
    else if (type == "teamAuditedData") {
        var teamId = $(this).attr("content");
        filemanager.load_AuditedData(spaceType[1]);
    }
    else if (type == "TeamRecycleData") {
        filemanager.load_TeamRecycleData(spaceType[1]);
    }

    else if (type == "xmkShareView") {
        filemanager.load_shareXmkShare();
    }
    else if (type == "xmkUnauditedData") {
        filemanager.load_ProjectUnauditedData();
    }
    else if (type == "xmkAuditedData") {
        filemanager.load_XMKAuditedData();
    }
    else if (type == "ProjectRecycleData") {
        filemanager.load_ProjectRecycleData();
    }

    else {
        document.getElementById("hidType").value = "";
        filemanager.load_contents(null, false);
    }
}
//加载个人空间我的共享文件夹列表
filemanager.load_shareMyView = function (userid,is_click) {
    document.getElementById("hidType").value = "shareMyView";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "space") {
        sortDesc = document.getElementById("hideSortSpaceDesc").value;
    }
   
    var attr = "{ userId:'" + userid + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";

    filemanager.post("GetMyShareView", attr, true, function (d) {
        var html = generateMyShareTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });

        filemanager.init_select();

    });
}

//课题组待审核列表
function getUnauditedDataTable(unauditedFiles) {

    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='2%' align='right'> <input type='checkbox' name='ckteamall' onchange='selectteamall()' /></th><th width='40%' align='center'>" + lang.file_name + "</th><th width='15%' align='center'>" + (this.IsHidden ? "<a class='invisible'></a>" : "<input type='button' onclick='preTeamCheckfile()' class='visible' title=" + lang.SPACE_View + "></input>&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Through + " onclick='AuditFiles()' onkeydown='' class='uponelevel'></input>&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Return + " onclick='BackFile()' class='back'></input>") + "</th><th width='10%' align='center'>" + lang.SPACE_UserName1_ + "<input type='button'  title=" + lang.sort + " onclick=sort('user') class='sorttype'></th><th width='10%' align='center'>" + lang.SPACE_SubmissionDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";

    html += "<tbody id='directory-content-list'>";
    var spaceType = "Person";
    $.each(unauditedFiles, function () {
        var path11 = "D:/TaDongDoc/" + this.SAVE_PATH + "/" + this.FILE_NAME;
        html += "<tr class='fe-file row' path='" + path11 + "'  rel='" + this.FILE_NAME + "'>";
        html += "<td align='center'><input type='checkbox' name='ck_team' value='" + this.FILE_ID + "'  /></td>";
        html += "<td><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        html += "<td align='center'></td>";
        html += "<td align='center'>" + this.USER_NAME + "</td>";
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";



       
        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

//课题组待审核全选
function selectalldata1() {
    for (i = 0; i < document.getElementsByName("cks").length; i++) {
        if (document.getElementsByName("ckalldata")[0].checked) {
            document.getElementsByName("cks")[i].checked = true;
        }
        else {
            document.getElementsByName("cks")[i].checked = false;
        }
    }
}

/*课题组通过*/
function AuditFile(id, team_id) {

    filemanager.load_GroupAuditData(id, team_id);

}
/*课题组批量通过*/
function AuditFiles() {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_team") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    filemanager.load_GroupAuditDatas(str);

}


/*课题组通过*/
filemanager.load_GroupAuditDatas = function (id) {
    var attr = "{ID:'" + id + "'}";
    var team_id = "";
    var spaceType = $("#hiddenType_Name_IsAdmin").val();
    spaceType = spaceType.split('|');
    if (spaceType[1] != "") {
        team_id = spaceType[1];
    }
//    filemanager.post("TeamAuditDatas", attr, true, function (d) {
//        if (d.d) {


            filemanager.team_AuditDatas(true, id, false, team_id);


            // box.alert("成功", "审核成功");
//        } else {
//            box.error("失败", "审核失败");
//        }

//        //filemanager.reload();

//    });

}

//课题组审核移动，拷贝
filemanager.team_AuditDatas = function (is_move, selected, is_click, team_id) {
    var count = 1;
    var heading = is_move ? lang.move : lang.copy;
    if (count > 0) {
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {
                // var selected = filemanager.get_selected();

                var newpath = $(this).find(".fe-newpath").val();
                if (newpath) {
                    //newpath = newpath.replace(" 主 目 录","");
                }
                var url = "GroupCutDatas";

                var this_box = this;
                var folderId;
                filemanager.post(url, "{ paths:'" + selected + "', newPath:'~/" + newpath + "'}", is_click, function (d) {
                    if (d.d) {
                        folderId = d.d.data;
                        box.alert(heading + lang.success, lang.SPACE_Audit_Success);
                        filemanager.load_UnauditedData(team_id);

                    } else {
                        box.error(d.d.message);

                    }
                    $(this_box).wijdialog("close");

                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + heading + lang.the_following_file_to + " /<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'>：</strong><br/>";
            html += "<div class='container_id' style=' margin-left:25px' >";
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + heading, html, {
                autoOpen: true,
                modal: true,
                width: 500,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }
            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }
}


//课题组审核移动，拷贝
filemanager.team_relocate = function (is_move, selected, is_click, team_id) {
    var count = 1; // filemanager.get_selected_count();
    var heading = is_move ? lang.move : lang.copy;
    if (count > 0) {
        //var count = filemanager.get_selected_count();
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {
                // var selected = filemanager.get_selected();

                var newpath = $(this).find(".fe-newpath").val();
                if (newpath) {
                    //newpath = newpath.replace(" 主 目 录","");
                }
                var url = is_move ? "Cut" : "Copy";
                if (g_sSpaceType == "group") {
                    url = "Group" + url;
                }
                if (g_sSpaceType == "project") {
                    url = "Project" + url;
                }
                //alert(g_sSpaceType)
                var this_box = this;
                var folderId;
                filemanager.post(url, "{ paths:'" + selected + "', newPath:'~/" + newpath + "'}", is_click, function (d) {
                    if (d.d) {
                        folderId = d.d.data;
                        box.alert(heading + lang.success, lang.SPACE_Audit_Success);
                        filemanager.load_UnauditedData(team_id);

                    } else {
                        box.error(d.d.message);

                    }
                    $(this_box).wijdialog("close");

                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + heading + lang.the_following_file_to + " /<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'>：</strong><br/>";
            html += "<div class='container_id' style=' margin-left:25px' >"; /// <reference path="../../jqueryFileTree/file_tree.htm" />
            //            html += "<div class='fe-filelist'>";
            //            html += filemanager.get_selected_list();
            ///html += "<iframe src='jqueryFileTree/file_tree.htm' style='width:100%; height:100%'></iframe>";
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + heading, html, {
                autoOpen: true,
                modal: true,
                width: 500,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }


                //                  box.dialog(lang.confirm+" "+ heading, html, {
                //                autoOpen: true,
                //                modal: true,
                //                width: 500,
                //                height: 180,
                //                buttons: buttons,
                //                captionButtons: {
                //                    pin: { visible: false },
                //                    refresh: { visible: false },
                //                    toggle: { visible: false },
                //                    minimize: { visible: false },
                //                    maximize: { visible: false }
                //                }
            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }
}


//加载课题组未审核数据列表
filemanager.load_UnauditedData = function (groupName, is_click) {
    document.getElementById("hidType").value = "teamUnauditedData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "user") {
        sortDesc = document.getElementById("hideSortUserDesc").value;
    }
    var attr = "{ groupName:'" + groupName + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";

    filemanager.post("GetUnauditedData", attr, true, function (d) {

        var html = getUnauditedDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });

        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });
        //加载多选器 initialise the multi-select
        filemanager.init_select();
        var pathss = filemanager.get_selected();
        

    });
}

//加载项目库未审核数据列表
function getProjectUnauditedDataTable(unauditedFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='2%' align='right'><input type='checkbox' name='ckxmkall' onchange='selectxmkall()' /></th><th width='40%' align='center'>" + lang.file_name + "</th><th width='15%' align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' onclick='preXmkCheckfile()' class='visible' title=" + lang.SPACE_View + "></input>&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Through + " onclick='AuditFile1()' class='uponelevel'></input>&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Return + " onclick='BackFile1()' class='back'></input>") + "</th><th width='10%' align='center'>" + lang.SPACE_UserName1_ + "<input type='button' title=" + lang.sort + " onclick=sort('user') class='sorttype'></th><th width='10%' align='center'>" + lang.SPACE_SubmissionDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";

    html += "<tbody id='directory-content-list'>";
    var spaceType = "Person";
    $.each(unauditedFiles, function () {
        var path11 = "D:/TaDongDoc/" + this.SAVE_PATH + this.FILE_NAME;
        html += "<tr class='fe-file row' path='" + path11 + "'  rel='" + this.FILE_NAME + "'>";
        html += "<td align='center'><input type='checkbox' name='ck_xmk' value='" + this.FILE_ID + "'  /></td>";
        html += "<td><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        html += "<td align='center'></td>";
        html += "<td align='center'>" + this.USER_NAME + "</td>";
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";


        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}


//项目库退回
function BackFile1() {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_xmk") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);

    box.open_window(lang.SPACE_Return, "UnauditedData/BackFile.aspx?File_ID=" + str + "&FileSpace_Type=XMK", 600, 220, true);
}
//项目库通过
function AuditFile1() {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_xmk") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
//    alert(str);
    filemanager.load_XMKAuditData(str);
    //alert("ssss")
}

filemanager.load_XMKAuditData = function (id) {
    //    var attr = "{ID:'" + id + "'}";
    //    //alert(attr);

    //    filemanager.post("XMKAuditData", attr, true, function (d) {
    //        if (d.d) {
    //            //filemanager.load_ProjectUnauditedData();


    //            filemanager.xmk_relocate(true, id, false);


    //            // box.alert("成功", "审核成功");
    //        } else {
    //            box.error("失败", "审核失败");
    //        }

    //        //filemanager.reload();

    //    });

    //alert(id);
    filemanager.xmk_relocates(true, id, false);

}

filemanager.xmk_relocates = function (is_move, selected, is_click) {
    var count = 1;
    var heading = is_move ? lang.move : lang.copy;
    if (count > 0) {
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {
                var newpath = $(this).find(".fe-newpath").val();
                if (newpath) {
                }
                var url = "ProjectCutDatas";
                //alert(g_sSpaceType)
                var this_box = this;
                var folderId;
                filemanager.post(url, "{ paths:'" + selected + "', newPath:'" + newpath + "'}", is_click, function (d) {
                    if (d.d.success) {
                        folderId = d.d.data;
                        box.alert(heading + lang.success, lang.SPACE_Audit_Success);
                        filemanager.load_ProjectUnauditedData();

                    } else {
                        box.error(d.d.message);

                    }
                    $(this_box).wijdialog("close");

                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + heading + lang.the_following_file_to + " /<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'>：</strong><br/>";
            html += "<div class='container_id' style=' margin-left:25px' >";
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + heading, html, {
                autoOpen: true,
                modal: true,
                width: 500,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }
            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }
}


//加载项目库未审核数据列表
filemanager.load_ProjectUnauditedData = function (is_click) {
    document.getElementById("hidType").value = "xmkUnauditedData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "user") {
        sortDesc = document.getElementById("hideSortUserDesc").value;
    }
    var attr = "{ pageNum:" + g_pageNum + ",sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',size:" + g_pageSize + "}";
    filemanager.post("GetProjectUnauditedData", attr, true, function (d) {

        // var folder = new Folder(d.d);

        var html = getProjectUnauditedDataTable(d.d);

        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });
        //加载多选器 initialise the multi-select
        //        filemanager.init_select();



    });
}


//加载个人我的提交
filemanager.load_MySubmitData = function (UserID, is_click) {
    //alert(UserID);
    document.getElementById("hidType").value = "perMySubmit";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "space") {
        sortDesc = document.getElementById("hideSortSpaceDesc").value;
    }

    var attr = "{ UserID:'" + UserID + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',status:'1',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";

    filemanager.post("GetMySubmitData", attr, true, function (d) {

        var html = getMySubmitDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });

        filemanager.init_select();



    });
}


//加载个人我的退回
filemanager.load_MyBackData = function (UserID, is_click) {
    //alert(UserID);
    document.getElementById("hidType").value = "MyBackData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "space") {
        sortDesc = document.getElementById("hideSortSpaceDesc").value;
    }
    var attr = "{ UserID:'" + UserID + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',status:'2',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";

    filemanager.post("GetMySubmitData", attr, true, function (d) {

        var html = getMyBackDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });

        filemanager.init_select();



    });
}

//个人空间我的退回列表
function getMyBackDataTable(shareFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='3%' align='center'><input type='checkbox' name='ckteamall' onchange='selectteamall()' /></th><th width='55%' align='center'>" + lang.file_name + "</th><th width='15%' align='center'><input type='button' title=" + lang.preview + " onclick='preTeamCheckfile()' class='visible'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Resubmit_ + " onclick='ResetSubmit1()' class='uponelevel'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Cancel + " onclick='BackSubmits()' class='back'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_View_a_single_receipt_ + " onclick='MyReceipts()' class='thumb'></input></th><th width='18% 'align='center'>" + lang.SPACE_Submit_research_group + "<input type='button' title=" + lang.sort + " onclick=sort('space') class='sorttype'></th><th width='12%' align='center'>" + lang.SPACE_Submit_time + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>"; //<th width='10%' align='center'>" + lang.SPACE_State + "</th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(shareFiles, function () {
        html += "<tr class='fe-file row'  rel='" + this.FILE_NAME + "'>";
        html += "<td  align='center'><input type='checkbox'  name='ck_team' value='" + this.FILE_ID + "' /></td>";
        html += "<td  align='center'><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";

        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "") + "</td>";
        html += "<td align='center'>" + this.TEAM_NAME + "</td>";
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";
//        html += "<td align='center'>" + this.STATSU + "</td>";

        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

//个人空间重新提交
function ResetSubmit1(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_team") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
   
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul>";
    html += "<li>将这些数据重新提交</li>";
    html += "<li class='split'></li>";
    html += "<li>确定吗？</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " '}";
        filemanager.post("NewAgainDataSubmit", data, is_click, function (d) {
            if (d.d.success) {
                $(this_box).wijdialog("close");
                var user_id = getCookie('_userId_');
                filemanager.load_MyBackData(user_id);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Resubmit_, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });

    //box.open_window(lang.SPACE_Resubmit_, "DataSubmit/AgainDataSubmit.aspx?File_ID=" + id + "&FileSpace_Type=Team", 743, 355, true);
}
//放弃提交
function BackSubmits(is_click) {

    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_team") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }

    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul>";
    html += "<li>" + lang.SPACE_Records_and_files_will_be_deleted_after_cancel + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var spaceType = "Person";
        var data = "{ FILE_ID:'" + str.toString() + " '}";
        filemanager.post("BackFile", data, is_click, function (d) {
            if (d.d.success) {
                //filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                var user_id = getCookie('_userId_');
                filemanager.load_MyBackData(user_id);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Cancel, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });
}

//查看回执
function MyReceipts() {

    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_team") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }

    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    var strs = str.split(',');
    var strlength = strs.length;
    
    if (strlength > 1) {
        box.alert(lang.error, lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }
   
    
    box.open_window(lang.SPACE_View_a_single_receipt_, "DataSubmit/MyReceipt.aspx?File_ID=" + str + "&FileSpace_Type=Team", 400, 300, true);
}

//加载个人空间回收站的数据
filemanager.load_RecycleData = function (UserID, is_click) {
    document.getElementById("hidType").value = "RecycleData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "size") {
        sortDesc = document.getElementById("hideSortSizeDesc").value;
    }
    var attr = "{ User_ID:'" + UserID + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";
    filemanager.post("GetRecycleData", attr, true, function (d) {
        var html = getRecycleDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });

        filemanager.init_select();
    });
}

//个人空间回收站列表
function getRecycleDataTable(Files) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='3%' align='center'><input type='checkbox' name='ckperall' onchange='selectperall()' /></th><th width='50%' align='center'>" + lang.file_name + "</th><th width='10%' align='center'>&nbsp;<input type='button' title=" + lang.preview + " onclick='prePerCheckfile()' class='visible'>&nbsp;&nbsp;<input type='button' id='btnRestore' title=" + lang.SPACE_Reduction + " class='submitable' onclick='Restore()' /><input type='button' id='btnDel' class='del' title=" + lang.del + " onclick='GetPerSelectFields()'/></th><th width='8%' align='right'>" + lang.file_size + "<input type='button' title=" + lang.sort + " onclick=sort('size') class='sorttype'></th><th width='9%' align='right'>" + lang.SPACE_Delete_time + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(Files, function () {
        html += "<tr class='fe-file row'  rel='" + this.Name + "' path='" + this.RelativePath + "'>";
        html += "<td  align='center'><input type='checkbox'  name='ck_per' value='" + this.FILE_ID + "' /></td>";
        html += "<td  align='center'><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
//        html += "<td align='center'><input type='button' title=" + lang.SPACE_Preview + " onclick='showfile(" + this.FILE_ID + ")' class='visible'></input></td>";
        //        html += "<td align='center'>" + this.SPACE_NAME + "</td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "") + "</td>";
        html += "<td align='center'>" + this.FILE_SIZE + "</td>";
        var myDate = new String(this.RECYCLE_DATE);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";

        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

//加载课题组回收站的数据
filemanager.load_TeamRecycleData = function (teamid, is_click) {
    document.getElementById("hidType").value = "TeamRecycleData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "size") {
        sortDesc = document.getElementById("hideSortSizeDesc").value;
    }

    var attr = "{ TeamID:'" + teamid + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";
    filemanager.post("GetTeamRecycleData", attr, true, function (d) {
        var html = getTeamRecycleDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });
        filemanager.init_select();
    });
}
//课题组回收站列表
function getTeamRecycleDataTable(Files) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='3%' align='center'><input type='checkbox' name='ckteamall' onchange='selectteamall()' /></th><th width='50%' align='center'>" + lang.file_name + "</th><th width='10%' align='center'>&nbsp;<input type='button' title=" + lang.preview + " onclick='preTeamCheckfile()' class='visible'>&nbsp;&nbsp;<input type='button' id='btnRestore' title=" + lang.SPACE_Reduction + " class='submitable' onclick='TeamRestore()' /><input type='button' id='btnDel' class='del' title=" + lang.del + " onclick='GetTeamSelectFields()'/></th><th width='8%' align='right'>" + lang.file_size + "<input type='button' title=" + lang.sort + " onclick=sort('size') class='sorttype'></th><th width='9%' align='right'>" + lang.SPACE_Delete_time + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(Files, function () {
        html += "<tr class='fe-file row'  rel='" + this.Name + "' path='" + this.RelativePath + "'>";
        html += "<td  align='center'><input type='checkbox'  name='ck_team' value='" + this.FILE_ID + "' /></td>";
        html += "<td  align='center'><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        //        html += "<td align='center'><input type='button' title=" + lang.SPACE_Preview + " onclick='showfile(" + this.FILE_ID + ")' class='visible'></input></td>";
        //        html += "<td align='center'>" + this.SPACE_NAME + "</td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "") + "</td>";
        html += "<td align='center'>" + this.FILE_SIZE + "</td>";
        var myDate = new String(this.RECYCLE_DATE);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";

        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}
//加载项目库回收站的数据
filemanager.load_ProjectRecycleData = function (is_click) {
    document.getElementById("hidType").value = "ProjectRecycleData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "size") {
        sortDesc = document.getElementById("hideSortSizeDesc").value;
    }
    var attr = "{pageNum:" + g_pageNum + ",sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',size:" + g_pageSize + "}";
    filemanager.post("GetProjectRecycleData", attr, true, function (d) {
        var html = getXmkRecycleDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });
        filemanager.init_select();
    });
}
//项目库回收站列表
function getXmkRecycleDataTable(Files) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='3%' align='center'><input type='checkbox' name='ckxmkall' onchange='selectxmkall()' /></th><th width='50%' align='center'>" + lang.file_name + "</th><th width='10%' align='center'>&nbsp;<input type='button' title=" + lang.preview + " onclick='preXmkCheckfile()' class='visible'>&nbsp;&nbsp;<input type='button' id='btnRestore' title=" + lang.SPACE_Reduction + " class='submitable' onclick='XmkRestore()' /><input type='button' id='btnDel' class='del' title=" + lang.del + " onclick='GetXmkSelectFields()'/></th><th width='8%' align='right'>" + lang.file_size + "<input type='button' title=" + lang.sort + " onclick=sort('size') class='sorttype'></th><th width='9%' align='right'>" + lang.SPACE_Delete_time + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(Files, function () {
        html += "<tr class='fe-file row'  rel='" + this.Name + "' path='" + this.RelativePath + "'>";
        html += "<td  align='center'><input type='checkbox'  name='ck_xmk' value='" + this.FILE_ID + "' /></td>";
        html += "<td  align='center'><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        //        html += "<td align='center'><input type='button' title=" + lang.SPACE_Preview + " onclick='showfile(" + this.FILE_ID + ")' class='visible'></input></td>";
        //        html += "<td align='center'>" + this.SPACE_NAME + "</td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "") + "</td>";
        html += "<td align='center'>" + this.FILE_SIZE + "</td>";
        var myDate = new String(this.RECYCLE_DATE);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";

        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}
//个人空间全选框per
function selectperall() {
    for (i = 0; i < document.getElementsByName("ck_per").length; i++) {
        if (document.getElementsByName("ckperall")[0].checked) {
            document.getElementsByName("ck_per")[i].checked = true;
        }
        else {
            document.getElementsByName("ck_per")[i].checked = false;
        }
    }
}
//课题组空间全选框team
function selectteamall() {
    for (i = 0; i < document.getElementsByName("ck_team").length; i++) {
        if (document.getElementsByName("ckteamall")[0].checked) {
            document.getElementsByName("ck_team")[i].checked = true;
        }
        else {
            document.getElementsByName("ck_team")[i].checked = false;
        }
    }
}
//项目库空间全选框xmk
function selectxmkall() {
    for (i = 0; i < document.getElementsByName("ck_xmk").length; i++) {
        if (document.getElementsByName("ckxmkall")[0].checked) {
            document.getElementsByName("ck_xmk")[i].checked = true;
        }
        else {
            document.getElementsByName("ck_xmk")[i].checked = false;
        }
    }
}
//全选框
function selectall() {
    for (i = 0; i < document.getElementsByName("ck").length; i++) {
        if (document.getElementsByName("ckall")[0].checked) {
            document.getElementsByName("ck")[i].checked = true;
        }
        else {
            document.getElementsByName("ck")[i].checked = false;
        }
    }
}

//个人空间回收站还原文件
function Restore(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_per") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul>";
    html += "<li>" + lang.SPACE_File_reduction + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var user_id = getCookie('_userId_');
    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
        filemanager.post("RestoreDataFile", data, is_click, function (d) {
            if (d.d.success) {
                //filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                 filemanager.load_RecycleData(user_id);
                
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Reduction, html, {
        autoOpen: true,
        modal: true,
        width: 300,
        height: 190,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });
 }

 //课题组回收站还原文件
 function TeamRestore(is_click) {
     var str = "";
     var inputs = document.getElementsByTagName("INPUT");
     for (var i = 0; i < inputs.length; i++) {
         if (inputs[i].type == 'checkbox') {
             if (inputs[i].name == "ck_team") {
                 if (inputs[i].checked == true) {
                     str += inputs[i].value + ",";
                 }
             }
         }
     }
     if (str == "") {
         box.alert(lang.error, lang.SPACE_No_data);
         return;
     }

     var html = "<ul>";
     html += "<li>" + lang.SPACE_File_reduction + "</li>";
     html += "<li class='split'></li>";
     html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
     html += "</ul>";

     var team_id = getCookie('team_id');
     var buttons = {};
     buttons[lang.confirm] = function () {
         var this_box = this;
         var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
         filemanager.post("RestoreDataFile", data, is_click, function (d) {
             if (d.d.success) {
                 //filemanager.reload(); //成功之后刷新
                 $(this_box).wijdialog("close");
                 filemanager.load_TeamRecycleData(team_id);
                 
             } else {
                 box.error(d.d.message);
             }
         });
     };
     buttons[lang.cancel] = function () {
         $(this).wijdialog("close");
     };

     box.dialog(lang.SPACE_Reduction, html, {
         autoOpen: true,
         modal: true,
         width: 300,
         height: 190,
         buttons: buttons,
         captionButtons: {
             pin: { visible: false },
             refresh: { visible: false },
             toggle: { visible: false },
             minimize: { visible: false },
             maximize: { visible: false }
         }
     });
 }

 //项目库回收站还原文件
 function XmkRestore(is_click) {
     var str = "";
     var inputs = document.getElementsByTagName("INPUT");
     for (var i = 0; i < inputs.length; i++) {
         if (inputs[i].type == 'checkbox') {
             if (inputs[i].name == "ck_xmk") {
                 if (inputs[i].checked == true) {
                     str += inputs[i].value + ",";
                 }
             }
         }
     }
     if (str == "") {
         box.alert(lang.error, lang.SPACE_No_data);
         return;
     }

     var html = "<ul>";
     html += "<li>" + lang.SPACE_File_reduction + "</li>";
     html += "<li class='split'></li>";
     html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
     html += "</ul>";

     var buttons = {};
     buttons[lang.confirm] = function () {
         var this_box = this;
         var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
         filemanager.post("RestoreDataFile", data, is_click, function (d) {
             if (d.d.success) {
                 //filemanager.reload(); //成功之后刷新
                 $(this_box).wijdialog("close");
                 filemanager.load_ProjectRecycleData();
                
             } else {
                 box.error(d.d.message);
             }
         });
     };
     buttons[lang.cancel] = function () {
         $(this).wijdialog("close");
     };

     box.dialog(lang.SPACE_Reduction, html, {
         autoOpen: true,
         modal: true,
         width: 300,
         height: 190,
         buttons: buttons,
         captionButtons: {
             pin: { visible: false },
             refresh: { visible: false },
             toggle: { visible: false },
             minimize: { visible: false },
             maximize: { visible: false }
         }
     });
 }

//个人空间回收站批量删除
function GetPerSelectFields(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_per") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul style='list-style-type:none'>";
    html += "<li>" + lang.SPACE_File_is_permanently_deleted_can_not_be_restored + "</li>";
    html += "<li class='split'><br /></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var user_id = getCookie('_userId_');
    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
        filemanager.post("DelDataFile", data, is_click, function (d) {
            if (d.d.success) {
                //filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                filemanager.load_RecycleData(user_id);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.del, html, {
        autoOpen: true,
        modal: true,
        width: 400,
        height: 190,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });


}

//课题组回收站批量删除
function GetTeamSelectFields(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_team") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul style='list-style-type:none'>";
    html += "<li>" + lang.SPACE_File_is_permanently_deleted_can_not_be_restored + "</li>";
    html += "<li class='split'><br /></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var team_id = getCookie('team_id');
    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
        filemanager.post("DelDataFile", data, is_click, function (d) {
            if (d.d.success) {
                //filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                 filemanager.load_TeamRecycleData(team_id);
              
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.del, html, {
        autoOpen: true,
        modal: true,
        width: 400,
        height: 190,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });

}

//项目库回收站批量删除
function GetXmkSelectFields(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_xmk") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul style='list-style-type:none'>";
    html += "<li>" + lang.SPACE_File_is_permanently_deleted_can_not_be_restored + "</li>";
    html += "<li class='split'><br /></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";
    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
        filemanager.post("DelDataFile", data, is_click, function (d) {
            if (d.d.success) {
                //filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                filemanager.load_ProjectRecycleData();
                

            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.del, html, {
        autoOpen: true,
        modal: true,
        width: 400,
        height: 190,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });


}

//加载课题组我的退回
filemanager.load_TeamMyBackData = function (TeamID, is_click) {
    document.getElementById("hidType").value = "teamMyBackData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    sortDesc = document.getElementById("hideSortTimeDesc").value;
    var attr = "{ TeamID:'" + TeamID + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',status:'2',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";

    filemanager.post("GetTeamMySubmitData", attr, true, function (d) {
        var html = getTeamMyBackDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });


        filemanager.init_select();
    });
}


//课题组空间我的退回列表
function getTeamMyBackDataTable(shareFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='3%' align='center'><input type='checkbox' name='ckxmkall' onchange='selectxmkall()' /></th><th width='55%' align='center'>" + lang.file_name + "</th><th width='12%' align='center'><input type='button' title=" + lang.preview + " onclick='preXmkCheckfile()' class='visible'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Resubmit_ + " onclick='xmkResetSubmit1()' class='uponelevel'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Cancel + " onclick='xmkBackSubmit1()' class='back'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_View_a_single_receipt_ + " onclick='xmkMyReceipt1()' class='thumb'></input></th><th width='10%' align='center'>" + lang.SPACE_SubmissionDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>"; //<th width='10%' align='center'>" + lang.SPACE_State + "</th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(shareFiles, function () {
        html += "<tr class='fe-file row'  rel='" + this.FILE_NAME + "'>";
        html += "<td  align='center'><input type='checkbox'  name='ck_xmk' value='" + this.FILE_ID + "' /></td>";
        html += "<td  align='center'><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";

        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "") + "</td>";
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";
//        html += "<td align='center'>" + this.STATSU + "</td>";

        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

//重新提交
function xmkResetSubmit1(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_xmk") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }

    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul>";
    html += "<li>将这些数据重新提交</li>";
    html += "<li class='split'></li>";
    html += "<li>确定吗？</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " '}";
        var spaceType = $("#hiddenType_Name_IsAdmin").val();
        if (spaceType) {
            spaceType = spaceType.split('|');
        }
        filemanager.post("TeamNewAgainDataSubmit", data, is_click, function (d) {
            if (d.d.success) {
                $(this_box).wijdialog("close");
                filemanager.load_TeamMyBackData(spaceType[1]);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Resubmit_, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 190,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });



    //box.open_window(lang.SPACE_Resubmit_, "DataSubmit/AgainDataSubmit.aspx?File_ID=" + id + "&FileSpace_Type=XMK", 743, 355, true);
}
//放弃提交
function xmkBackSubmit1(is_click) {

    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_xmk") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }

    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul>";
    html += "<li>" + lang.SPACE_Records_and_files_will_be_deleted_after_cancel + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " '}";
        var spaceType = $("#hiddenType_Name_IsAdmin").val();
        if (spaceType) {
            spaceType = spaceType.split('|');
        }
        filemanager.post("TeamBackFile", data, is_click, function (d) {
            if (d.d.success) {
                $(this_box).wijdialog("close");
                filemanager.load_TeamMyBackData(spaceType[1]);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Cancel, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });
}

//查看回执
function xmkMyReceipt1() {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_xmk") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }

    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    var strs = str.split(',');
    var strlength = strs.length;

    if (strlength > 1) {
        box.alert(lang.error, lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }

    box.open_window(lang.SPACE_View_a_single_receipt_, "DataSubmit/MyReceipt.aspx?File_ID=" + str + "&FileSpace_Type=XMK", 400, 300, true);
}



//加载课题组我的提交
filemanager.load_TeamMySubmitData = function (TeamID, is_click) {
    document.getElementById("hidType").value = "teamMySubmit";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    sortDesc = document.getElementById("hideSortTimeDesc").value;

    var attr = "{ TeamID:'" + TeamID + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',status:'1',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";
    
    filemanager.post("GetTeamMySubmitData", attr, true, function (d) {
        var html = getTeamMySubmitDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });


        filemanager.init_select();
    });
}

//课题组空间我的提交列表
function getTeamMySubmitDataTable(shareFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='80%' align='center'>" + lang.file_name + "</th><th width='5%' align='center'>" + lang.file_permission + "</th><th width='15%' align='center'>" + lang.SPACE_SubmissionDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>"; //<th width='10%' align='center'>" + lang.SPACE_State + "</th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(shareFiles, function () {
        html += "<tr class='fe-file row'  rel='" + this.FILE_NAME + "'>";
       
        html += "<td  align='center'><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
//        if (this.STATSU == "已审核") {
        html += "<td align='center'><input type='button' title=" + lang.preview + " onclick='preXmkSinglefile(" + this.FILE_ID + ")' class='visible'></input></td>";
//        }
//        else if (this.STATSU == "未审核") {
//            html += "<td align='center'><input type='button' title=" + lang.preview + " onclick='showfile2(" + this.FILE_ID + ")' class='visible'></input></td>";
//        }
//        else if (this.STATSU == "已退回") {
//            html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' title=" + lang.preview + " onclick='showfile2(" + this.FILE_ID + ")' class='visible'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Resubmit_ + " onclick='xmkResetSubmit(" + this.FILE_ID + ")' class='uponelevel'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Cancel + " onclick='xmkBackSubmit(" + this.FILE_ID + "," + this.TEAM_ID + ")' class='back'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_View_a_single_receipt_ + " onclick='xmkMyReceipt(" + this.FILE_ID + ")' class='thumb'></input>") + "</td>";
//        }
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";
       // html += "<td align='center'>" + this.STATSU + "</td>";
        
        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

//重新提交
function xmkResetSubmit(id) {
    box.open_window(lang.SPACE_Resubmit_, "DataSubmit/AgainDataSubmit.aspx?File_ID=" + id + "&FileSpace_Type=XMK", 743, 355, true);
}
//放弃提交
function xmkBackSubmit(id, teamid, is_click) {
    var html = "<ul>";
    html += "<li>" + lang.SPACE_Records_and_files_will_be_deleted_after_cancel + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var spaceType = "Person";
        var data = "{ FILE_ID:'" + id.toString() + " '}";
        filemanager.post("TeamBackFile", data, is_click, function (d) {
            if (d.d.success) {
                filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                filemanager.load_TeamMySubmitData(teamid);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Cancel, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });
}

//查看回执
function xmkMyReceipt(id) {
    box.open_window(lang.SPACE_View_a_single_receipt_, "DataSubmit/MyReceipt.aspx?File_ID=" + id + "&FileSpace_Type=XMK", 400, 300, true);
}

//加载课题组已审核数据列表
filemanager.load_AuditedData = function (groupName, is_click) {
    document.getElementById("hidType").value = "teamAuditedData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "user") {
        sortDesc = document.getElementById("hideSortUserDesc").value;
    }
    var attr = "{ groupName:'" + groupName + "',sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + "}";

    filemanager.post("GetAuditedData", attr, true, function (d) {

        var html = getAuditedDataTable(d.d);
        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount = this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });

        //加载多选器 initialise the multi-select
        filemanager.init_select();

    });
}

//加载课题组已审核数据列表
function getAuditedDataTable(unauditedFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='50%' align='center'>" + lang.file_name + "</th><th width='5%' align='center'>" + lang.file_permission + "</th><th width='10%' align='center'>" + lang.SPACE_UserName1_ + "<input type='button' title=" + lang.sort + "  onclick=sort('user') class='sorttype'></th><th width='10%' align='center'>" + lang.SPACE_SubmissionDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";

    html += "<tbody id='directory-content-list'>";
    var spaceType = "Person";
    $.each(unauditedFiles, function () {
        html += "<tr class='fe-file row' rel='" + this.FILE_NAME + "'>";
        html += "<td><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' onclick='preTeamSinglefile(" + this.FILE_ID + ")' class='visible' title=" + lang.SPACE_View + "></input>") + "</td>";
        html += "<td align='center'>" + this.USER_NAME + "</td>";
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";

        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}


//加载项目库已审核数据列表
filemanager.load_XMKAuditedData = function (is_click) {

    document.getElementById("hidType").value = "xmkAuditedData";
    var sorttype = document.getElementById("hideSortType").value;
    var sortDesc;
    if (sorttype == "time") {
        sortDesc = document.getElementById("hideSortTimeDesc").value;
    }
    if (sorttype == "user") {
        sortDesc = document.getElementById("hideSortUserDesc").value;
    }
    var attr = "{pageNum:" + g_pageNum + ",sorttype:'" + sorttype + "',sortdesc:'" + sortDesc + "',size:" + g_pageSize + "}";
    filemanager.post("GetXMKAuditedData", attr, true, function (d) {

        // var folder = new Folder(d.d);

        var html = getXMKAuditedDataTable(d.d);

        $(".content-list").html(html);
        $(".directory-content").chromatable({
            width: "100%", height: $("#divid").height() * 0.95 + "px",
            scrolling: "yes"
        });
        var FileCount = "";
        $.each(d.d, function () {
            FileCount =this.FileCount;
        });
        $('#pag').pagination({ total: FileCount });


        //加载多选器 initialise the multi-select
        filemanager.init_select();


    });
}

//加载项目库已审核数据列表
function getXMKAuditedDataTable(unauditedFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='50%' align='center'>" + lang.file_name + "</th><th width='5%' align='center'>" + lang.file_permission + "</th><th width='10%' align='center'>" + lang.SPACE_UserName1_ + "<input type='button' title=" + lang.sort + " onclick=sort('user') class='sorttype'></th><th width='10%' align='center'>" + lang.SPACE_SubmissionDate + "<input type='button' title=" + lang.sort + "  onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";

    html += "<tbody id='directory-content-list'>";
    var spaceType = "Person";
    $.each(unauditedFiles, function () {
        html += "<tr class='fe-file row' rel='" + this.FILE_NAME + "'>";
        html += "<td><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;''  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' onclick='preXmkSinglefile(" + this.FILE_ID + ")' class='visible' title=" + lang.SPACE_View + "></input>") + "</td>";
        html += "<td align='center'>" + this.USER_NAME + "</td>";
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";
        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

function t(obj,path) {

    var spaceType = $("#hiddenType_Name_IsAdmin").val();
    paixutype = obj.value;
        if (spaceType) {
            spaceType = spaceType.split('|');
            }
        if (!g_pageNum || !g_pageSize) {
            g_pageNum = 1;
            g_pageSize = 20;
        }

        var url = "DataOrder";
        path = filemanager.get_path();

        
        var attr = "{  op:'" + obj.value + "',path:'" + path + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + ",FileType:'" + spaceType[0] + "',ID:'" + spaceType[1] + "'}";
        
        filemanager.post(url, attr, true, function (d) {

            var folder = new Folder(d.d);
            if (!folder.hasError()) {
                var html = "";
                if (filemanager.mode == "table") {
                    html = folder.generateTable();
                } else if (filemanager.mode == "thumb") {
                    html = folder.generateThumbList();
                }

                $(".content-list").html(html);
                $(".directory-content").chromatable({
                    width: "100%", height: $("#divid").height() * 0.95 + "px",
                    scrolling: "yes"
                });
                $(".fe-folder-info").html(folder.getMiniInfo());
                var i = 0;
            }
        });

}

var parentFolderId = null;
//加载文件夹列表课题组
filemanager.load_contents = function (path, is_click) {
    // alert(path);
    //document.getElementById("hidType").value = "";
    var url = "GetFolder";
    var url1 = "GetFolder";
    var FileType;
    var attr = "{ path:'" + path + "'}";
    //document.getElementById("hidpath").value = path;
    
    document.getElementById("hidpath").value = path;
    //    alert(document.getElementById("hidpath").value);
    var spaceType = $("#hiddenType_Name_IsAdmin").val();
    if (spaceType) {
        spaceType = spaceType.split('|');

        if (spaceType[0] == "project") {
            if (!isPag) {
                g_path = path;
            }
            else {
                path = g_path;
            }
            parentFolderId = filemanager.get_selected_parentId();
            //alert(parentFolderId);
            url = "GetFolderFromDB";
            is_click = false;
            // g_pageNum = pageNumber;
            //g_pageSize = pageSize;
            if (!g_pageNum || !g_pageSize) {
                g_pageNum = 1;
                g_pageSize = 20;
            }
            attr = "{ op:'" + paixutype + "',path:'" + path + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + ",FileType:'XMK',ID:'" + spaceType[1] + "'}";
            url1 = "GetNavigate";
        }
        if (spaceType[0] == "individual") {
            //alert("个人");

            if (!isPag) {
                g_path = path;
            }
            else {
                path = g_path;
            }

            parentFolderId = filemanager.get_selected_parentId();
            url = "GetFolderFromDB";
            is_click = false;
            if (!g_pageNum || !g_pageSize) {
                g_pageNum = 1;
                g_pageSize = 20;
            }
            attr = "{ op:'" + paixutype + "', path:'" + path + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + ",FileType:'PERSON',ID:'" + spaceType[1] + "'}";
            url1 = "GetNavigate";
        }
        if (spaceType[0] == "group") {
            //alert("课题组");
            if (!isPag) {
                g_path = path;
            }
            else {
                path = g_path;
            }
            parentFolderId = filemanager.get_selected_parentId();
            url = "GetFolderFromDB";
            is_click = false;
            if (!g_pageNum || !g_pageSize) {
                g_pageNum = 1;
                g_pageSize = 20;
            }
            attr = "{ op:'" + paixutype + "', path:'" + path + "',pageNum:" + g_pageNum + ",size:" + g_pageSize + ",FileType:'TEAM',ID:'" + spaceType[1] + "'}";
            url1 = "GetNavigate";
        }

    }
    // 请求当前的站点导航
    filemanager.post(url1, attr, is_click, function (d) {
        document.getElementById("hidType").value = "";
        //获取返回的字符串，包括文件夹名称和文件夹ID
        var Navigate = d.d;
        document.getElementById("txtNavigate").value = Navigate;
        var lblNavigates = $("#txtNavigate").val();
        //alert(lblNavigates);
        var naviagte = new Array();
        naviagte = lblNavigates.split(":");

        var list = "&nbsp;&nbsp;<a href='#' rel=0 class='top_nav'  />" + lang.SPACE_Root_directory + " > "; //" 根目录 > ";
        //        alert(naviagte);
        for (i = 0; i < naviagte.length; i++) {
            if (i % 2 == 0) {
                //                alert(naviagte[i]);
                //                alert(naviagte[i + 1]);
                list += "<a href='#' rel='" + naviagte[i + 1] + "' class='top_nav'  />" + naviagte[i] + " > ";

            }

        }
        list = list.substring(0, list.length - 2);
        //        alert(list);
        document.getElementById('divNavigate').innerHTML = list;

        $(".top_nav").click(function () {

            //filemanager.load_contents(naviagte[i + 1], true);

            filemanager.load_contents($(this).attr("rel"), true)
        });


    });

    filemanager.post(url, attr, is_click, function (d) {

        var folder = new Folder(d.d);
        if (!folder.hasError()) {
            var html = "";
            if (filemanager.mode == "table") {
                html = folder.generateTable();
            } else if (filemanager.mode == "thumb") {
                html = folder.generateThumbList();
            }

            //   $(".content-list").html(html);
            $(".content-list")[0].innerHTML = html;
            $(".directory-content").chromatable({
                width: "100%", height: $("#divid").height() * 0.95 + "px",
                scrolling: "yes"
            });
            $(".fe-folder-info").html(folder.getMiniInfo());
            var i = 0;
            $('.nav').each(function () {

                //  stuHover($(this));
                //  $('.jsddm > li').bind('mouseover', jsddm_open);
                // $('.jsddm > li').bind('mouseout', jsddm_timer);
                //$(this).superfish({
                //add options here if required
                //	});
                //add options here if required
            });



            //历史记录
            var current_history = filemanager.history[filemanager.current_position];

            if (((current_history != null && path != filemanager.history[filemanager.current_position].getPath()) || current_history == null)) {
                filemanager.current_position++;
                filemanager.history[filemanager.current_position] = folder;
            }
            $(".fe-current-path").val(folder.getPath());
            $('#pag').pagination({ total: d.d.FileCount });
            if (g_sSpaceType == "project") {
                //$('#pag').pagination({ total: d.d.FileCount });
                $("#hfCurrentPath").val(path);
            }
            else {
                $("#hfCurrentPath").val(folder.getRelativePath());
                //$('#pag').pagination({ total: d.d.FileCount });
            }

            //记录浏览记录到 log record browse history to log
            log.log_text(lang.browse_history + folder.getRelativePath());

            //加载多选器 initialise the multi-select
            // filemanager.init_select();
            $("#directory-content-list tr").click(function () {

                $("#directory-content-list tr").each(function () {
                    $(this).removeClass("click_mode");
                    $(this).find("div").css('visibility', 'hidden');
                });
                $(this).addClass("click_mode");
                $(this).find("div").css('visibility', 'visible')
                g_selected_file_id = $(this).attr("path");

            });
            //加载文件夹右键菜单 initialise the right click menu
            var dir_menu = [];
            //            var dm_1 = {};
            //            dm_1[lang.open] = function (menuItem, menu) { filemanager.load_contents($(this).attr("path"), true); };
            //            if ($("#hidden_identity").val() != "visit") {
            //                dm_1[lang.download] = function (menuItem, menu) { filemanager.download($(this).attr("path")); };
            //            }
            //              dir_menu.push(dm_1);
            //------复制、移动-------------------------------------------
            //dir_menu.push($.contextMenu.separator);
            var dm_2 = {};
            dm_2[lang.move] = function (menuItem, menu) { filemanager.relocate(true, "wjj"); };
            // dm_2[lang.copy] = function (menuItem, menu) { filemanager.relocate(false,"wjj"); };

            //-----删除、重命名-------------------------------------------
            dir_menu.push($.contextMenu.separator);
            var dm_3 = {};
            dm_3[lang.del] = function (menuItem, menu) { filemanager.remove(true, "wjj"); };
            dm_3[lang.rename] = function (menuItem, menu) { filemanager.rename($(this).attr("path"), $(this).attr("rel"), 'wjj'); };
            //-------------------------------------------------
            //              dir_menu.push($.contextMenu.separator);
            //              var dm_4 = {};
            //              dm_4[lang.compress] = function (menuItem, menu) { filemanager.compress(); };
            //              dm_4[lang.rename] = function (menuItem, menu) { filemanager.rename($(this).attr("path"), $(this).attr("rel")); };

            //-------------------------------------------------
            //               dir_menu.push($.contextMenu.separator);
            //               var dm_5 = {};
            //               dm_5[lang.new_file] = function (menuItem, menu) { $(".cmd-newfile").click(); };
            //               dm_5[lang.new_folder] = function (menuItem, menu) { $(".cmd-newdirectory").click(); };
            //               dm_5[lang.view_property] = function (menuItem, menu) { filemanager.load_folder($(this).attr("path")); };

            //            if ($("#hidden_identity").val() != "visit") {
            dir_menu.push(dm_2);
            dir_menu.push(dm_3);
            //dir_menu.push(dm_4);
            // dir_menu.push(dm_5);
            //            }

            //加载文件右键菜单
            var file_menu = new Array;
            var fm_1 = {};
            var fm_4 = {};


            if (parent_type == "THEME_ENGINE") {
                fm_1[lang.edit] = function (menuItem, menu) {
                    var full_path = $(this).attr("path").replace("~/", file_base_url);
                    parent.pe.insert_image(full_path);
                }; //从页面引擎呼叫
            }
            //----------右键弹出对话框功能-----------------
            //fm_1[lang.edit] = function (menuItem, menu) { filemanager.editfile($(this).attr("path")); };
            if ($("#hidden_identity").val() != "visit" && g_sSpaceType != "project" && g_isDataManage == false) {
                fm_1[lang.share] = function (menuItem, menu) { filemanager.sharefile($(this).attr("path"), $(this).attr("rel")); };
                fm_1[lang.submit] = function (menuItem, menu) { filemanager.submitfile($(this).attr("path"), $(this).attr("rel")); };

                //  fm_4[lang.new_file] = function (menuItem, menu) { $(".cmd-newfile").click(); };
                fm_4[lang.new_folder] = function (menuItem, menu) { $(".cmd-newdirectory").click(); };
            }
            fm_4[lang.view_property] = function (menuItem, menu) { filemanager.load_file($(this).attr("path")); };

            fm_1[lang.preview] = function (menuItem, menu) { filemanager.previewfile($(this).attr("path"), $(this).attr("rel")); };
            fm_1[lang.download] = function (menuItem, menu) { filemanager.download($(this).attr("path")); };
            file_menu.push(fm_1);
            file_menu.push($.contextMenu.separator);
            //-------------------------------------------------
            var fm_2 = {};
            fm_2[lang.move] = function (menuItem, menu) { filemanager.relocate(true, "wj"); };
            fm_2[lang.copy] = function (menuItem, menu) { filemanager.relocate(false, "wj"); };

            //-------------------------------------------------
            var fm_3 = {};
            fm_3[lang.del] = function (menuItem, menu) { filemanager.remove(true, "wj"); };
            fm_3[lang.rename] = function (menuItem, menu) { filemanager.rename($(this).attr("path"), $(this).attr("rel"), 'wj'); };

            //-------------------------------------------------


            if ($("#hidden_identity").val() != "visit") {

                file_menu.push(fm_2);
                file_menu.push($.contextMenu.separator);
                file_menu.push(fm_3);
                file_menu.push($.contextMenu.separator);
                file_menu.push(fm_4);
            }

            //if (g_sSpaceType == "project") {
            //   $(".fe-dir").contextMenu(dir_menu, { theme: 'vista' });
            //}

            //   $(".fe-file").contextMenu(file_menu, { theme: 'vista' });
        } else {
            box.error(folder.getError());
        }
    });
}

//只选中一个文件或文件夹 select only one file or folder
filemanager.select_one = function (path) {
    $(".row").removeClass("ui-selected");
    $(".row[path='" + path + "']").addClass("ui-selected");

}

//加载文件属性 Load file properties
filemanager.load_file = function (path, is_click) {
    var attr = "{ path:'" + path + "'}";
    filemanager.post("GetFileInfo", attr, is_click, function (d) {
        var file = new File(d.d);
        var title = file.getName() + " " + lang.property;
        var content = file.getInfo();
        //弹框按钮
        var buttons = {};
        buttons[lang.confirm] = function () {
            filemanager.set_file_attributes(this);
            $(this).wijdialog("close");
        };
        buttons[lang.cancel] = function () {
            $(this).wijdialog("close");
        };
        buttons[lang.apply] = function () {
            filemanager.set_file_attributes(this);
        };

        box.dialog(title, content, {
            autoOpen: true,
            modal: true,
            width: 550,
            height: 500,
            buttons: buttons,
            captionButtons: {
                pin: { visible: false },
                refresh: { visible: false },
                toggle: { visible: false },
                minimize: { visible: false },
                maximize: { visible: false }
            }
        });
    });
}
//加载文件夹属性 Load Folder properties
filemanager.load_folder = function (path, is_click) {
    var attr = "{ path:'" + path + "'}";
    filemanager.post("GetFolderInfo", attr, is_click, function (d) {
        var folder = new Folder(d.d);
        var title = folder.getName() + " " + lang.property;
        var content = folder.getInfo();

        //弹框按钮
        var buttons = {};
        buttons[lang.confirm] = function () {
            filemanager.set_folder_attributes_action(this);
            $(this).wijdialog("close");
        };
        buttons[lang.cancel] = function () {
            $(this).wijdialog("close");
        };
        buttons[lang.apply] = function () {
            filemanager.set_folder_attributes_action(this);
        };

        //创建窗口
        box.dialog(title, content, {
            autoOpen: true,
            modal: true,
            width: 550,
            height: 500,
            buttons: buttons,
            captionButtons: {
                pin: { visible: false },
                refresh: { visible: false },
                toggle: { visible: false },
                minimize: { visible: false },
                maximize: { visible: false }
            }
        });
    });
}


//设置文件夹的属性 Updae directory properties
filemanager.set_folder_attributes_action = function (win) {
    //弹框按钮
    var buttons = {};
    buttons[lang.yes] = function () {
        filemanager.set_folder_attributes(win, true);
        $(this).wijdialog("close");
    };
    buttons[lang.no] = function () {
        filemanager.set_folder_attributes(win, false);
        $(this).wijdialog("close");
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.question, lang.question_apply_to_subfolders, {
        autoOpen: true,
        modal: true,
        width: 250,
        height: 150,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });
}

//设定文件夹读写权限
filemanager.set_folder_attributes = function (win, recursive, is_click) {
    var is_readonly = $(win).find(".fe-isreadonly").is(":checked");
    var is_hidden = $(win).find(".fe-ishidden").is(":checked");
    var is_system = $(win).find(".fe-issystem").is(":checked");
    var is_archive = $(win).find(".fe-isarchive").is(":checked");
    var is_writable = $(win).find(".fe-app-iswritable").is(":checked");
    var is_browsable = $(win).find(".fe-app-isbrowsable").is(":checked");
    var path = $(win).find(".fe-propertypath").val();
    var data = "{ path:'" + path + "',isHidden:" + is_hidden + ", isReadOnly:" + is_readonly + ", isSystem:" + is_system + ", isArchive:" + is_archive + ", recursive:" + recursive + ", isWritable:" + is_writable + ", isBrowsable:" + is_browsable + "}";
    filemanager.post("SetFolderAttributes", data, is_click, function (d) {
        if (d.d.success) {
            box.alert(lang.success, d.d.message);
        } else {
            box.error(d.d.message);
        }
        filemanager.reload();
    });
}


//设定文件读写权限
filemanager.set_file_attributes = function (win, is_click) {
    var is_readonly = $(win).find(".fe-isreadonly").is(":checked");
    var is_hidden = $(win).find(".fe-ishidden").is(":checked");
    var is_system = $(win).find(".fe-issystem").is(":checked");
    var is_archive = $(win).find(".fe-isarchive").is(":checked");
    var is_writable = $(win).find(".fe-app-iswritable").is(":checked");
    var is_browsable = $(win).find(".fe-app-isbrowsable").is(":checked");
    var path = $(win).find(".fe-propertypath").val();
    var data = "{ path:'" + path + "',isHidden:" + is_hidden + ", isReadOnly:" + is_readonly + ", isSystem:" + is_system + ", isArchive:" + is_archive + ", isWritable:" + is_writable + ", isBrowsable:" + is_browsable + "}";
    filemanager.post("SetFileAttributes", data, is_click, function (d) {
        if (d.d.success) {
            box.alert(lang.success, d.d.message);
        } else {
            box.error(d.d.message);
        }
        filemanager.reload();
    });
}


//上一级目录
filemanager.uponelevel = function () {

    if (g_sSpaceType == "project") {

        filemanager.load_contents(parentFolderId, true);

        return;
    }
    var current_path = filemanager.get_path();
    if (current_path.endsWith("/")) {
        current_path = current_path.removeLastChar();
    }
    var parts = current_path.split('/');
    var path = "";
    if (parts.length > 1) {
        for (var i = 0; i <= (parts.length - 2); i++) {
            path += parts[i];
            path += "/";
        }
    } else {
        //show you are at root folder tip
        box.alert(lang.tips, lang.tips_you_are_at_root);
        path = "~/";
    }
    filemanager.load_contents(path, true);
}

//上一页
filemanager.back = function () {
    if (filemanager.current_position > 0 && filemanager.current_position < filemanager.history.length) {
        filemanager.current_position -= 1;
        var path = filemanager.history[filemanager.current_position].getRelativePath();
        //        if (g_sSpaceType == "project") {
        //            path = filemanager.history[filemanager.current_position].getPath();
        //        }
        filemanager.load_contents(path, false);
    }
}
//上一页
filemanager.forward = function () {
    if (filemanager.current_position >= 0 && filemanager.current_position < (filemanager.history.length - 1)) {
        filemanager.current_position += 1;
        var path = filemanager.history[filemanager.current_position].getRelativePath();
        filemanager.load_contents(path, false);
    }
}


/****************************************************************************************************************************/

//压缩
filemanager.compress = function (is_click) {
    var count = filemanager.get_selected_count();
    if (count > 0) {
        var html = "<div class='fe-notes'>";
        html += "<strong>" + lang.tips_zip_confirm_message + "<input class='fe-zipname' typed='text'/>.zip</strong><br/>";
        //        html += "<div class='fe-filelist'>";
        html += filemanager.get_selected_list();
        html += "</div>";
        html += "</div>";

        var buttons = {}
        buttons[lang.confirm] = function () {
            var selected = filemanager.get_selected();
            var zip_name = $(this).find(".fe-zipname").val();
            var this_box = this;
            if (zip_name) {
                zip_name += ".zip";
                var path = filemanager.get_path(); //直接压缩到本文件夹
                filemanager.post("CompressDatas", "{ paths:'" + selected + "', dest:'" + path + "', zipName:'" + zip_name + "'}", is_click, function (d) {
                    if (d.d.success) {
                        box.alert(lang.tips_zip_success, d.d.message);
                        filemanager.reload();
                        $(this_box).wijdialog("close");
                    } else {
                        box.error(d.d.message);
                    }
                });
            } else {
                box.error(lang.tips_enter_file_name);
            }
        };
        buttons[lang.cancel] = function () {
            $(this).wijdialog("close");
        };

        box.dialog(lang.tips_zip_confirm, html, {
            autoOpen: true,
            modal: true,
            width: 500,
            buttons: buttons,
            captionButtons: {
                pin: { visible: false },
                refresh: { visible: false },
                toggle: { visible: false },
                minimize: { visible: false },
                maximize: { visible: false }
            }
        });
    } else {
        //Please first select one to many files or folders
        box.error(lang.tips_select_file_folder_name);
    }
}

//解压缩 Extract zip file
filemanager.extract = function (is_click) {
    var count = filemanager.get_selected_count();
    var selected_zip = filemanager.get_selected();
    var html = "<ul class='fe-form'>";
    html += "<li><label>" + lang.zip_file + "</label>" + selected_zip + "</li>";
    html += "<li><label>" + lang.extact_location + "</label>/ <input class='fe-extractto' type='text' value='" + filemanager.get_path().replace("~/", "") + "'/></li>";
    html += "<li><label>" + lang.replace_current_files + "</label><input class='fe-extractoverwrite' type='checkbox' checked='checked'/></li>";
    html += "</ul>";
    if (count == 1 && selected_zip.endsWith(".zip")) {
        var buttons = {};
        buttons[lang.confirm] = function () {
            var extract_to = "~/" + $(this).find(".fe-extractto").val();
            var this_box = this;
            var overwrite = $(this).find(".fe-extractoverwrite").is(":checked");
            var path = filemanager.get_path(); //直接压缩到本文件夹
            filemanager.post("Extract", "{ path:'" + selected_zip + "', dest:'" + extract_to + "', overwrite:" + overwrite + "}", is_click, function (d) {
                if (d.d.success) {
                    box.alert(lang.extract_successful, d.d.message);
                    filemanager.reload();
                    $(this_box).wijdialog("close");
                } else {
                    box.error(d.d.message);
                }
            });
        };
        buttons[lang.cancel] = function () {
            $(this).wijdialog("close");
        };


        box.dialog(lang.extract_file, html, {
            autoOpen: true,
            modal: true,
            width: 500,
            buttons: buttons,
            captionButtons: {
                pin: { visible: false },
                refresh: { visible: false },
                toggle: { visible: false },
                minimize: { visible: false },
                maximize: { visible: false }
            }
        });

    } else {
        //please select a zip file for extraction
        box.error(lang.tips_select_zip);
    }
}

/****************************************************************************************************************************/

//审核
filemanager.relocate_groupAudited = function (file_id, is_move, is_click) {
    /////////////////////////////

    var count = filemanager.get_selected_count();
    var heading = is_move ? lang.move : lang.copy;
    if (count > 0) {
        var count = filemanager.get_selected_count();
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {
                var selected = filemanager.get_selected();

                var newpath = $(this).find(".fe-newpath").val();
                if (newpath) {
                    //newpath = newpath.replace(" 主 目 录","");
                }
                var url = is_move ? "Cut" : "Copy";
                if (g_sSpaceType == "group") {
                    url = "Group" + url;
                }
                if (g_sSpaceType == "project") {
                    url = "Project" + url;
                }
                // alert(url)
                var this_box = this;
                var folderId;
                filemanager.post(url, "{ paths:'" + file_id + "', newPath:'~/" + newpath + "'}", is_click, function (d) {
                    if (d.d) {
                        folderId = d.d;
                        box.alert(lang.success, lang.SPACE_Audit_Success);
                    } else {
                        box.error(d.d.message);
                    }
                    $(this_box).wijdialog("close");

                    if (g_sSpaceType == "project") {

                        filemanager.load_contents(folderId);
                        filemanager.load_contents(filemanager.get_path());
                        if (wjjtype == "wjj") {

                            $('#file_tree').fileTree({
                                root: '',
                                script: 'jqueryFileTree/connectors/jqueryFileTree.aspx',
                                expandSpeed: 1000,
                                collapseSpeed: 1000,
                                multiFolder: false,
                                baseUrl: $("#baseUrl").val()
                            }, function (file) {
                                alert(file);
                            });

                        }
                    }
                    else {
                        filemanager.reload();
                    }
                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + heading + lang.the_following_file_to + " /<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'>：</strong><br/>";
            html += "<div class='container_id' style=' margin-left:25px' />"; /// <reference path="../../jqueryFileTree/file_tree.htm" />
            //            html += "<div class='fe-filelist'>";
            //            html += filemanager.get_selected_list();
            ///html += "<iframe src='jqueryFileTree/file_tree.htm' style='width:100%; height:100%'></iframe>";
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + heading, html, {
                autoOpen: true,
                modal: true,
                width: 500,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }

                //            box.dialog(lang.confirm + " " + heading, html, {
                //                autoOpen: true,
                //                modal: true,
                //                width: 500,
                //                height: 180,
                //                buttons: buttons,
                //                captionButtons: {
                //                    pin: { visible: false },
                //                    refresh: { visible: false },
                //                    toggle: { visible: false },
                //                    minimize: { visible: false },
                //                    maximize: { visible: false }
                //                }
            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }


    ////////////////////////////

    //    var count = filemanager.get_selected_count();
    //    var heading = is_move ? lang.move : lang.copy;
    //    if (count > 0) {
    //        var count = filemanager.get_selected_count();
    //        if (count > 0) {
    //            var buttons = {};
    //            buttons[lang.confirm] = function () {
    //                var selected = filemanager.get_selected();

    //                var newpath = $(this).find(".fe-newpath").val();
    //                if (newpath) {
    //                    //newpath = newpath.replace(" 主 目 录","");
    //                }
    //                var url = is_move ? "Cut" : "Copy";
    //                if (g_sSpaceType == "group") {
    //                    url = "Group" + url;
    //                }
    //                if (g_sSpaceType == "project") {
    //                    url = "Project" + url;
    //                }
    //                //alert(g_sSpaceType)
    //                var this_box = this;
    //                var folderId;
    //                filemanager.post(url, "{ paths:'" + selected + "', newPath:'~/" + newpath + "'}", is_click, function (d) {
    //                    if (d.d.success) {
    //                        folderId = d.d.data;
    //                        box.alert(heading + lang.success, d.d.message);
    //                    } else {
    //                        box.error(d.d.message);
    //                    }
    //                    $(this_box).wijdialog("close");
    //                    //if (isGroupAuditFile) {
    //                        var groupName = $('.preverify_group').attr("content");
    //                        filemanager.load_UnauditedData(groupName);
    //                        return;
    //                    //}

    //                });
    //            };

    //            buttons[lang.cancel] = function () {
    //                $(this).wijdialog("close");
    //            };

    //            var html = "<div class='fe-notes'>";
    //            html += "<strong>" + lang.are_you_sure + heading + lang.the_following_file_to + " /<input type='textbox'  class='fe-newpath'/>：</strong><br/>";
    //            html += "<div class='container_id' />"; /// <reference path="../../jqueryFileTree/file_tree.htm" />
    //            //            html += "<div class='fe-filelist'>";
    //            html += filemanager.get_selected_list();
    //            ///html += "<iframe src='jqueryFileTree/file_tree.htm' style='width:100%; height:100%'></iframe>";
    //            html += "</div>";
    //            html += "</div>";
    //            var box_id = box.dialog_tree(lang.confirm + " " + heading, html, {
    //                autoOpen: false,
    //                modal: true,
    //                width: 500,
    //                buttons: buttons,
    //                captionButtons: {
    //                    pin: { visible: false },
    //                    refresh: { visible: false },
    //                    toggle: { visible: false },
    //                    minimize: { visible: false },
    //                    maximize: { visible: false }
    //                }
    //            });
    //        } else {
    //            box.error(lang.tips_select_file_folder_name);
    //        }
    //    } else {
    //        box.error(lang.tips_select_file_folder_name);
    //    }
}





//项目库审核移动，拷贝
filemanager.xmk_relocate = function (is_move, selected, is_click) {
    var count = 1; // filemanager.get_selected_count();
    var heading = is_move ? lang.move : lang.copy;
    if (count > 0) {
        //var count = filemanager.get_selected_count();
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {
                // var selected = filemanager.get_selected();

                var newpath = $(this).find(".fe-newpath").val();
                if (newpath) {
                    //newpath = newpath.replace(" 主 目 录","");
                }
                var url = is_move ? "Cut" : "Copy";
                if (g_sSpaceType == "group") {
                    url = "Group" + url;
                }
                if (g_sSpaceType == "project") {
                    url = "Project" + url;
                }
                //alert(g_sSpaceType)
                var this_box = this;
                var folderId;
                filemanager.post(url, "{ paths:'" + selected + "', newPath:'~/" + newpath + "'}", is_click, function (d) {
                    if (d.d.success) {
                        folderId = d.d.data;
                        box.alert(heading + lang.success, lang.SPACE_Audit_Success);
                        filemanager.load_ProjectUnauditedData();

                    } else {
                        box.error(d.d.message);

                    }
                    $(this_box).wijdialog("close");

                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + heading + lang.the_following_file_to + " /<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'>：</strong><br/>";
            html += "<div class='container_id' style=' margin-left:25px' >"; /// <reference path="../../jqueryFileTree/file_tree.htm" />
            //            html += "<div class='fe-filelist'>";
            //            html += filemanager.get_selected_list();
            ///html += "<iframe src='jqueryFileTree/file_tree.htm' style='width:100%; height:100%'></iframe>";
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + heading, html, {
                autoOpen: true,
                modal: true,
                width: 500,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }

                //            box.dialog(lang.confirm + " " + heading, html, {
                //                autoOpen: true,
                //                modal: true,
                //                width: 500,
                //                height: 180,
                //                buttons: buttons,
                //                captionButtons: {
                //                    pin: { visible: false },
                //                    refresh: { visible: false },
                //                    toggle: { visible: false },
                //                    minimize: { visible: false },
                //                    maximize: { visible: false }
                //                }
            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }
}





//移动，拷贝
filemanager.relocate = function (is_move, wjjtype, is_click) {
    var count = filemanager.get_selected_count();
    var heading = is_move ? lang.move : lang.copy;
    if (count > 0) {
        var count = filemanager.get_selected_count();
        var selected = filemanager.get_selected();
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {
                //var selected = filemanager.get_selected();

                var newpath = $(this).find(".fe-newpath").val();
                if (newpath) {
                    //newpath = newpath.replace(" 主 目 录","");
                }
                var url = is_move ? "Cut" : "Copy";
                if (g_sSpaceType == "individual" & wjjtype == "wjj") {
                    url = "Person" + url + "WJJ";
                }
                if (g_sSpaceType == "individual" & wjjtype == "wj") {
                    url = "Person" + url + "WJ";
                }
                if (g_sSpaceType == "group" & wjjtype == "wj") {
                    url = "Team" + url + "WJ";
                }
                if (g_sSpaceType == "group" & wjjtype == "wjj") {
                    url = "Team" + url + "WJJ";
                }
                if (g_sSpaceType == "project" & wjjtype == "wj") {
                    url = "Project" + url;
                }
                if (g_sSpaceType == "project" & wjjtype == "wjj") {
                    url = "Project" + url + "WJJ";
                }
                // alert(url)
                var this_box = this;
                var folderId;
                filemanager.post(url, "{ paths:'" + selected + "', newPath:'~/" + newpath + "'}", is_click, function (d) {
                    if (d.d.success) {
                        folderId = d.d.data;
                        box.alert(heading + lang.success, d.d.message);
                    } else {
                        box.error(d.d.message);
                    }
                    $(this_box).wijdialog("close");

                    if (g_sSpaceType == "project") {

                        filemanager.load_contents(folderId);
                        filemanager.load_contents(filemanager.get_path());
                        if (wjjtype == "wjj") {

                            $('#file_tree').fileTree({
                                root: '',
                                script: 'jqueryFileTree/connectors/jqueryFileTree.aspx',
                                expandSpeed: 1000,
                                collapseSpeed: 1000,
                                multiFolder: false,
                                baseUrl: $("#baseUrl").val()
                            }, function (file) {
                                alert(file);
                            });

                        }
                    }
                    else {
                        filemanager.reload();
                    }
                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + heading + lang.the_following_file_to + " /<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'>：</strong><br/>";
            html += "<div class='container_id' style=' margin-left:25px' >"; /// <reference path="../../jqueryFileTree/file_tree.htm" />
            //            html += "<div class='fe-filelist'>";
            //            html += filemanager.get_selected_list();
            ///html += "<iframe src='jqueryFileTree/file_tree.htm' style='width:100%; height:100%'></iframe>";
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + heading, html, {
                autoOpen: true,
                modal: true,
                width: 500,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }
                //                 box.dialog(lang.confirm+" "+ heading, html, {
                //                autoOpen: true,
                //                modal: true,
                //                width: 500,
                //                height: 180,
                //                buttons: buttons,
                //                captionButtons: {
                //                    pin: { visible: false },
                //                    refresh: { visible: false },
                //                    toggle: { visible: false },
                //                    minimize: { visible: false },
                //                    maximize: { visible: false }
                //}

            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }
}
//共享
filemanager.sharefile = function (relativePath, name, is_click) {
    box.open_window("文件共享", fe_url + "/ShareFile/FileShare.aspx?path=" + escape(relativePath) + "&filename=" + escape(name), 420, 420, true);

}

//提交
filemanager.submitfile = function (relativePath, name, is_move, is_click) {
    var spaceType = $("#hiddenType_Name_IsAdmin").val();

    if (spaceType) {
        spaceType = spaceType.split('|');
        if (spaceType[0] == "project") {
            spaceType = spaceType[0];
        }
    }
    if (!spaceType) {
        spaceType = "individual";
    }
    box.open_window(lang.SPACE_Data_Submit, fe_url + "/DataSubmit/NewDataSubmit.aspx?path=" + relativePath + "&filename=" + name + "&spacetype=" + spaceType, 720, 550, true);
}


//删除
filemanager.remove = function (is_click, wjtype) {
    var count = filemanager.get_selected_count();
    if (count > 0) {
        var html = "<div class='fe-notes'>";
        html += "<strong>" + lang.tips_confirm_delete + "</strong><br/>";
        //        html += "<strong>是否移动到回收站</strong><br/>";
        //        html += "<div class='fe-filelist'>";
        //html += filemanager.get_selected_list();
        //      html += "</div>";
        html += "</div>";

        var buttons = {};
        var paths = filemanager.get_selected();
        buttons[lang.confirm] = function () {
            //var paths = filemanager.get_selected();
            var recursive = $(this).find(".fe-delete-recursive").is(":checked");
            var this_box = this;
            var delUrl = "Delete";
            if (g_sSpaceType == "individual" && wjtype == "wjj") {
                delUrl = "PersonDeleteWJJ";
            }
            if (g_sSpaceType == "individual" && wjtype == "wj") {
                delUrl = "PersonRemoveToRecycleWJ";
            }
            if (g_sSpaceType == "group" && wjtype == "wj") {
                delUrl = "TeamRemoveToRecycleWJ";
            }
            if (g_sSpaceType == "group" && wjtype == "wjj") {
                delUrl = "TeamDeleteWJJ";
            }
            else if (g_sSpaceType == "project" && wjtype == "wj") {
                delUrl = "ProjectRemoveToRecycle";
            }
            if (g_sSpaceType == "project" && wjtype == "wjj") {
                delUrl = "ProjectDeleteWJJ";
            }
            filemanager.post(delUrl, "{ paths:'" + paths + " ', recursive: " + recursive + "}", is_click, function (d) {

                if (d.d.success) {

                    box.alert(lang.success, d.d.message);
                    if (delUrl == "ProjectDelete") {
                        filemanager.load_contents(d.d.data);
                    }
                    else {
                        filemanager.reload();


                        $('#file_tree').fileTree({
                            root: '',
                            script: 'jqueryFileTree/connectors/jqueryFileTree.aspx',
                            expandSpeed: 1000,
                            collapseSpeed: 1000,
                            multiFolder: false,
                            baseUrl: $("#baseUrl").val()
                        }, function (file) {
                            alert(file);
                        });

                    }
                }
                else {
                    box.error(d.d.message);
                }
                $(this_box).wijdialog("close");
            });
        };
        buttons[lang.cancel] = function () {
            $(this).wijdialog("close");
        };

        box.dialog(lang.tips_confirm_delete, html, {
            autoOpen: true,
            modal: true,
            width: 300,
            buttons: buttons,
            captionButtons: {
                pin: { visible: false },
                refresh: { visible: false },
                toggle: { visible: false },
                minimize: { visible: false },
                maximize: { visible: false }
            }
        });
    } else {
        box.error(lang.tips_select_file_folder_name);
    }
}

//重命名
filemanager.rename = function (relativePath, name, wjtype, is_click) {


    var html = "<ul class='fe-form'>";
    html += "<li><label>" + lang.new_name + "</label><input class='fe-newname' type='text' value='" + name + "' /></li>";
    html += "<li class='split'></li>";
    //    html += "<li><label>" + lang.location + "</label>" + relativePath + "</li>";
    html += "<input class='fe-newnamepath' type='hidden' value='" + relativePath + "'/>";
    html += "<li><label>" + lang.original_name + "</label>" + name + "</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var newname = $(this).find(".fe-newname").val();
        var path = $(this).find(".fe-newnamepath").val();
        //alert(path);
        var this_box = this;
        if (newname) {
            //alert(wjtype);
            var renameUrl = "Rename";
            if (g_sSpaceType == "individual" && wjtype == "wjj") {
                renameUrl = "individualRenameWJJ";
            }
            if (g_sSpaceType == "individual" && wjtype == "wj") {
                renameUrl = "individualRenameWJ";
                
            }
            if (g_sSpaceType == "group" && wjtype == "wj") {
                renameUrl = "TeamRenameWJ";
            }
            if (g_sSpaceType == "group" && wjtype == "wjj") {
                renameUrl = "TeamRenameWJJ";
            }
            if (g_sSpaceType == "project" && wjtype == "wj") {
                renameUrl = "ProjectRename";
            }
            if (g_sSpaceType == "project" && wjtype == "wjj") {
                renameUrl = "ProjectRenameWJJ";
            }
            var data = "{ path:'" + path + "', newName:'" + newname + "'}";
            filemanager.post(renameUrl, data, is_click, function (d) {
                if (d.d.success) {
                    box.alert(lang.success, d.d.message);
                    if (g_sSpaceType == "project") {
                        if (wjtype == "wjj") {
                            filemanager.load_contents(filemanager.get_path());

                            $('#file_tree').fileTree({
                                root: '',
                                script: 'jqueryFileTree/connectors/jqueryFileTree.aspx',
                                expandSpeed: 1000,
                                collapseSpeed: 1000,
                                multiFolder: false,
                                baseUrl: $("#baseUrl").val()
                            }, function (file) {
                                alert(file);
                            });

                        }
                        else {
                            filemanager.load_contents(d.d.data);
                        }
                    }
                    else {
                        filemanager.reload();
                    }
                    $(this_box).wijdialog("close");
                } else {
                    box.error(d.d.message);
                }
            });
        } else {
            box.error(lang.file_name_cannot_be_null);
        }
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };


    box.dialog(lang.rename + name, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 220,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });
}
//新文件
filemanager.newfile = function (is_click) {
    var html = "<ul class='fe-form'>";
    html += "<li><label>" + lang.file_name + "</label><input type='text' class='fe-newfile-name'/></li>";
    html += "</ul>";
    var buttons = {};
    buttons[lang.confirm] = function () {
        var name = $(this).find(".fe-newfile-name").val();
        var this_box = this;
        filemanager.post("NewFile", "{ path:'" + filemanager.get_path() + "', name:'" + name + "'}", is_click, function (d) {
            if (d.d.success) {
                $(this_box).wijdialog("close");
                filemanager.reload(); //成功之后刷新
                box.alert(lang.success, d.d.message);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");

    };


    box.dialog(lang.new_name, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });

}
//新文件夹
filemanager.newdirectory = function (is_click) {
    var html = "<ul class='fe-form'>";
    html += "<li><label>" + lang.title + "</label><input type='text' class='fe-newdirectory-name'/></li>";
    html += "</ul>";

    var spaceType = $("#hiddenType_Name_IsAdmin").val();
    if (spaceType) {
        spaceType = spaceType.split('|');
    }
    //alert(spaceType[1]);
    var url = 'NewFolder';
    if (g_sSpaceType == "project") {
        url = 'ProjectNewFolder';
    }
    if (g_sSpaceType == "individual") {
        url = 'PersonNewFolder';
    }
    if (g_sSpaceType == "group") {
        url = 'TeamNewFolder';
    }
    var buttons = {};
    buttons[lang.confirm] = function () {
        var name = $(this).find(".fe-newdirectory-name").val();

        if (name == lang.SPACE_Pending_review) {
            box.error(lang.SPACE_This_folder_name_is_already_taken);
            return;
        }
        var this_box = this;
        if (g_sSpaceType == "group") {
            filemanager.post(url, "{ path:'" + filemanager.get_path() + "', name:'" + name + "',team_id:" + spaceType[1] + "}", is_click, function (d) {
                if (d.d.success) {
                    if (g_sSpaceType == "project") {
                        filemanager.load_contents(d.d.data);
                    }
                    else {
                        filemanager.reload(); //成功之后刷新
                    }
                    $('#file_tree').fileTree({
                        root: '',
                        script: 'jqueryFileTree/connectors/jqueryFileTree.aspx',
                        expandSpeed: 1000,
                        collapseSpeed: 1000,
                        multiFolder: false,
                        baseUrl: $("#baseUrl").val()
                    }, function (file) {
                        alert(file);
                    });

                    box.alert(lang.success, d.d.message);
                    $(this_box).wijdialog("close");
                } else {
                    box.error(d.d.message);
                }
            });
        }
        else {
            filemanager.post(url, "{ path:'" + filemanager.get_path() + "', name:'" + name + "'}", is_click, function (d) {
                if (d.d.success) {
                    if (g_sSpaceType == "project") {
                        filemanager.load_contents(d.d.data);
                    }
                    else {
                        filemanager.reload(); //成功之后刷新
                    }
                    $('#file_tree').fileTree({
                        root: '',
                        script: 'jqueryFileTree/connectors/jqueryFileTree.aspx',
                        expandSpeed: 1000,
                        collapseSpeed: 1000,
                        multiFolder: false,
                        baseUrl: $("#baseUrl").val()
                    }, function (file) {
                        alert(file);
                    });

                    box.alert(lang.success, d.d.message);
                    $(this_box).wijdialog("close");
                } else {
                    box.error(d.d.message);
                }
            });
        }
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.new_folder, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });

}
//编辑文件
filemanager.editfile = function (url, is_click) {
    if (url.endsWith("txt") || url.endsWith("xml") || url.endsWith("config") || url.endsWith("html")
     || url.endsWith("htm") || url.endsWith("js") || url.endsWith("css") || url.endsWith("php")) {
        box.open_window(lang.edit_text_file, fe_url + "/TextEditor.aspx?Path=" + url, 690, 545, true);
    } else {
        box.error(lang.tips_file_format_not_supported);
    }
}

//上传文件
filemanager.upload = function () {
    var path = encodeURI(filemanager.get_path());
    
    box.open_window(lang.upload_files, fe_url + "/FileUploader.aspx?path=" + path + "&spaceType=" + g_sSpaceType + "&groupId=" + g_sGroupId, 500, 400, true);
}

//下载文件
filemanager.download = function (is_click) {
    if (filemanager.get_selected_count() > 0) {
        var paths = filemanager.get_selected();
        paths = "./WebServices/Download.aspx?filePath=" + paths + "&spacetype=" + g_sSpaceType;
        $("#fileDownFrame").attr("src", paths);

    } else {
        box.error(lang.tips_select_files);
    }

}


//批量下载文件
filemanager.downloaddatas = function (paths, is_click) {
    var buttons = {};
    buttons[lang.confirm] = function () {
        $(this).wijdialog("close");
    };
    filemanager.post("DownloadDatas", "{paths:'" + paths + "',SpaceType:'" + g_sSpaceType + "'}", is_click, function (d) {
        if (d.d.success) {
            var html = "<a href='" + d.d.message + "' target='_blank'>" + lang.tips_click_here_to_download + d.d.message + "</a>";
            //box.alert(lang.download_file, html);
            box.dialog(lang.download_file, html, {
                autoOpen: true,
                modal: true,
                width: 500,
                height: 200,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }
            });

        } else {
            box.error(d.d.message);
        }
    });
}


//下载文件
filemanager.downloadByClick = function (paths) {
    
    paths = "./WebServices/Download.aspx?filePath=" + paths + "&spacetype=" + g_sSpaceType;
    
    $("#fileDownFrame").attr("src", paths);

}


//初始化多选
filemanager.init_select = function () {
    $("#directory-content-list").selectable({ filter: '.row' });
}

// class file
var File = function (fileObj) {
    var fileObj = fileObj;

    this.isImage = function () {
        var exts = ".jpg,.jpeg,.png,.gif,.bmp,.svg";
        return exts.indexOf(fileObj.Extension) > -1;
    }
    this.isText = function () {
        var exts = ".txt,.html,.js,.css,.htmlx,.htm,.xml,.config,.php,.vb,.cs,.sql,.asp,.aspx";
        return exts.indexOf(fileObj.Extension) > -1;
    }
    this.getName = function () {
        return fileObj.Name;
    }
    this.getPath = function () {
        return fileObj.RelativePath.replace("~/", "");
    }
    this.getRelativePath = function () {
        return fileObj.RelativePath;
    }
    this.getThumbnailPath = function () {
        return filemanager.base_thumb_url + fileObj.ThumbnailName;
    }

    this.getInfo = function () {
        var html = "";
        if (this.isImage()) {
            html += "<img src='" + this.getThumbnailPath() + "' class='fe-thumbnail'/>";
        }
        html += "<ul class='fe-form'>";
        html += "<li><label>" + lang.file_name + "</label>" + fileObj.Name + "</li>";
        html += "<li><label>" + lang.file_ext + "</label>" + fileObj.Extension + "</li>";
        html += "<li class='split'></li>";
        html += "<li><label>" + lang.file_path + "</label>" + fileObj.Path + "</li>";
        html += "<input class='fe-propertypath' type='hidden' value='" + fileObj.RelativePath + "'/>";
        html += "<li><label>" + lang.file_size + "</label>" + fileObj.SizeString + "(" + fileObj.Size + lang.bytes + ")</li>";
        html += "<li class='split'></li>";
        html += "<li><label>" + lang.file_created + "</label>" + fileObj.CreatedString + "</li>";
        html += "<li><label>" + lang.file_last_updated + "</label>" + fileObj.LastModifiedString + "</li>";
        html += "<li><label>" + lang.file_last_visited + "</label>" + fileObj.LastAccessedString + "</li>";
        html += "<li class='split'></li>";
        if (this.isText()) {
            html += "<li><label>" + lang.operation + "</label><a class='fe-editfile' rel='" + this.getRelativePath() + "' href='javascript:void(0)'>" + lang.edit + "</a></li>";
            html += "<li class='split'></li>";
        }
        html += "<li><label>" + lang.read_only + "</label><input class='fe-isreadonly' type='checkbox' " + (fileObj.IsReadOnly ? "checked='checked'" : "") + "/>" + lang.read_only_explain + " </li>";
        html += "<li><label>" + lang.hidden + "</label><input class='fe-ishidden' type='checkbox' " + (fileObj.IsHidden ? "checked='checked'" : "") + "/>" + lang.hidden_explain + "</li>";
        html += "<li><label>" + lang.system + "</label><input class='fe-issystem' type='checkbox' " + (fileObj.IsSystem ? "checked='checked'" : "") + "/></li>";
        html += "<li><label>" + lang.archive + "</label><input class='fe-isarchive' type='checkbox' " + (fileObj.IsArchive ? "checked='checked'" : "") + "/></li>";
        html += "<li class='split'></li>";
        html += "<li><label>" + lang.readable + "</label><input class='fe-app-iswritable' type='checkbox' " + (fileObj.IsWritable ? "checked='checked'" : "") + "/> " + lang.writable_explain + "</li>";
        html += "<li><label>" + lang.writable + "</label><input class='fe-app-isbrowsable' type='checkbox' " + (fileObj.IsBrowsable ? "checked='checked'" : "") + "/> " + lang.readable_explain + "</li>";
        html += "</ul>";
        html += fileObj.Permission;
        return html;
    }
}


//class Folder
var Folder = function (folderObj) {
    var folderObj = folderObj;
    this.hasError = function () {
        return folderObj.ErrorOccured;
    }
    this.getError = function () {
        return folderObj.Error;
    }

    this.getName = function () {
        return folderObj.Name;
    }

    this.getPath = function () {
        if (folderObj.RelativePath != null)
            return folderObj.RelativePath.replace("~/", "");
    }

    this.getRelativePath = function () {
        return folderObj.RelativePath;
    }





    //生成列表
    this.generateTable = function () {

        var spaceType = $("#hiddenType_Name_IsAdmin").val();
        var isadmin = "";
        var person = "";
        if (spaceType) {
            spaceType = spaceType.split('|');
            if (spaceType[2]) {
                isadmin = spaceType[2];
            }
            person = spaceType[0];
        }
        text1 = "";

        //        if ($("#hidden_identity").val() == "visit") {
        text1 = "<div style='float:left;margin-right:15px;'>";
        text1 += " <ul class='nav1'>"
        text1 += "<li class='top'><a href='#' id='products' class='top_link'><span style='font-size:14px' class='down'></span></a>"
        text1 += "	<ul class='sub'>"
        if ($("#hidden_identity").val() != "visit" && g_sSpaceType != "project" && g_sSpaceType != "group" && g_isDataManage == false) {
            text1 += "		<li><a href='javascript:file_sharedatas()'>" + lang.SPACE_Sharing + "</a></li>"
        }

        text1 += "		<li><a href='javascript:file_copydatas()'>" + lang.SPACE_Copy + "</a></li>"
        text1 += "		<li><a href='javascript:file_movedatas()'>" + lang.SPACE_Move + "</a></li>"
        //        text1 += "		<li><a href='javascript:file_onlineshow()'>" + lang.SPACE_Preview + "</a></li>"
        text1 += "		<li><a href='javascript:GetSelectFieldsdata()'>" + lang.del + "</a></li>"
        text1 += "		<li><a href='javascript:file_renamedatas()'>" + lang.SPACE_Rename + "</a></li>"
        //        text1 += "		<li><a href='javascript:file_editsourcefiles()'>" + lang.SPACE_Modify_metadata + "</a></li>"
        text1 += "	</ul>"
        text1 += "</li>"
        text1 += "</ul>"
        text1 += "</div>"
        //        }
        if (isadmin == "IsAdmin" || person == "individual" || isadmin == "manage") {

        }
        else {
            text1 = "";
        }
        var html = "<table class='directory-content'>";
        html += "<thead>";
        html += "<tr><th width='2%' align='right'><input type='checkbox' name='ckalldata' onchange='javascript:selectalldata()' /></th>";
        if (isadmin == "IsAdmin" || person == "individual") {
            if (g_sSpaceType != "project") {
                html += "<th  width='53%' align='left'>" + lang.file_name + "</th><th width='18%'>" + "<input type='button' title='" + lang.SPACE_Preview + "' onclick='javascript:file_onlineshow()' class='visible'><input type='button'  title='" + lang.download + "' onclick='javascript:DownLoaddatas()' class='editable'></input> ";
                html += "<input type='button' id='btnedit' class='editable1' title='" + lang.SPACE_Modify_metadata + "' onclick='javascript:file_editsourcefiles()'/> <input type='button'  title='" + lang.submit + "' onclick='javascript:Submitdatas()' class='submitable'></input> " + text1 + "" + "</th>";
            }
            else {
                html += "<th  width='53%' align='left'>" + lang.file_name + "</th><th width='18%'>" + "<input type='button' title='" + lang.SPACE_Preview + "' onclick='javascript:file_onlineshow()' class='visible'><input type='button'  title='" + lang.download + "' onclick='javascript:DownLoaddatas()' class='editable'></input> ";
                html += "<input type='button' id='btnedit' class='editable1' title='" + lang.SPACE_Modify_metadata + "' onclick='javascript:file_editsourcefiles()'/>  " + text1 + "" + "</th>";
            }
        }
        else if (isadmin == "manage") {
            html += "<th  width='53%' align='left'>" + lang.file_name + "</th><th width='18%'>" + "<input type='button' title='" + lang.SPACE_Preview + "' onclick='javascript:file_onlineshow()' class='visible'><input type='button'  title='" + lang.download + "' onclick='javascript:DownLoaddatas()' class='editable'></input> ";
            html += "<input type='button' id='btnedit' class='editable1' title='" + lang.SPACE_Modify_metadata + "' onclick='javascript:file_editsourcefiles()'/> "+ text1 + "" + "</th>";
        }
        else {
            html += "<th  width='53%' align='left'>" + lang.file_name + "</th><th width='18%'>" + "<input type='button' title='" + lang.SPACE_Preview + "' onclick='javascript:file_onlineshow()' class='visible'><input type='button'  title='" + lang.download + "' onclick='javascript:DownLoaddatas()' class='editable'></input></th>";
        }
        html += "<th  width='17%'>" + lang.file_size + "</th>";
        html += "<th  width='10%'>" + lang.file_last_updated + "</th></tr>";
        html += "</thead>";

        html += "<tbody id='directory-content-list'>";

        $.each(folderObj.Folders, function () {
            if (this.LastModifiedString == '1000-01-01 00:00') {
                this.LastModifiedString = "";
            }
            text = "";

            if ($("#hidden_identity").val() != "visit") {
                text = "<div style='float:right;visibility: hidden;margin-right:25px;'>";
                text += " <ul class='nav'>"
                text += "<li class='top'><a href='#' id='products' class='top_link'><span class='down' style='font-size:14px'></span></a>"
                text += "	<ul class='sub'>"

                text += "		<li><a href='javascript:folder_move()'>" + lang.SPACE_Move + "</a></li>"
                text += "		<li><a href='javascript:folder_remove()'>" + lang.del + "</a></li>"
                text += "		<li><a href='javascript:folder_rename()'>" + lang.SPACE_Rename + "</a></li>"


                text += "	</ul>"
                text += "</li>"

                text += "</ul>"
                text += "</div>"

            }



            html += "<tr class='fe-dir row' rel='" + this.Name + "' path='" + this.RelativePath + "'>";
            html += "<td></td>";
            html += "<td><a class='dir' rel='" + this.RelativePath + "' href='javascript:void(0)'>" + this.Name + "</a>" + "</td>";

            if (isadmin == "IsAdmin" || person == "individual") {

                html += "<td><input type='button' id='btnedit' class='move' title='" + lang.move + "' onclick='javascript:folder_move()'/><input type='button' id='del' class='del' title='" + lang.del + "' onclick='javascript:folder_remove()'/><input type='button' id='btnedit' class='rename' title='" + lang.rename + "' onclick='javascript:folder_rename()'/></td>";

            }
            else {
                html += "<td></td>";
            }
            html += "<td>" + lang.sub_file + ": " + this.FileCount + " " + lang.sub_folder + ": " + this.FolderCount + "</td>";
            html += "<td>" + this.LastModifiedString + "</td>";
            html += "</tr>";
        });
        $.each(folderObj.Files, function () {

            text = "";

            if ($("#hidden_identity").val() != "visit") {
                text = "<div style='float:left;visibility: hidden;margin-right:15px;'>";
                text += " <ul class='nav'>"
                text += "<li class='top'><a href='#' id='products' class='top_link'><span style='font-size:14px' class='down'></span></a>"
                text += "	<ul class='sub'>"
                if ($("#hidden_identity").val() != "visit" && g_sSpaceType != "project" && g_isDataManage == false) {
                    text += "		<li><a href='javascript:file_share()'>" + lang.SPACE_Sharing + "</a></li>"
                }
                text += "		<li><a href='javascript:file_copy()'>" + lang.SPACE_Copy + "</a></li>"
                text += "		<li><a href='javascript:file_move()'>" + lang.SPACE_Move + "</a></li>"
                text += "		<li><a href='javascript:file_rename()'>" + lang.SPACE_Rename + "</a></li>"

                text += "	</ul>"

                text += "</li>"

                text += "</ul>"
                text += "</div>"
            }


            html += "<tr class='fe-file row' rel='" + this.Name + "' path='" + this.RelativePath + "'>";
            html += "<td> <input type='checkbox' name='cks' value='" + this.RelativePath + "'  /></td>";
            html += "<td><a  style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;' rel='" + this.RelativePath + "' href='javascript:void(0)'>" + this.Name + "</a> " + "</td>";
            html += "<td></td>"
            html += "<td>" + this.SizeString + "</td>";
            html += "<td>" + this.LastModifiedString + "</td>";

            html += "</tr>";
        });
        html += "</tbody>";
        html += "</table>";
        return html;
    }





    function hasAuthority() {


    }

    this.generateThumbList = function () {
        var html = "<div class='directory-content'>";
        //上级目录
        html += "<div class='cmd-uponelevel-dot'></div>";
        html += "<div id='directory-content-list'>";
        $.each(folderObj.Folders, function () {
            if (this.Name == lang.SPACE_Pending_review)
                return true;
            html += "<div class='fe-dir row' rel='" + this.Name + "'  onclick='javascript:test()'  path='" + this.RelativePath + "'>";
            html += "<div class='fe-thumb'><img src='Thumb/icons/directory.png' /></div>";
            html += "<div class='fe-row-name'><a rel='" + this.RelativePath + "' href='javascript:test()'>" + this.Name + "</a></div>";
            html += "<div class='fe-row-size'></div>";
            html += "<div class='fe-row-permission'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<div class='visible'></div>") + (this.IsReadOnly ? "" : "<div class='editable'></div>") + "</div>";
            html += "</div>";
        });
        $.each(folderObj.Files, function () {
            html += "<div class='fe-file row' rel='" + this.Name + "' path='" + this.RelativePath + "'>";
            html += "<div class='fe-thumb'><img src='" + filemanager.base_thumb_url + this.ThumbnailName + "' /></div>";
            html += "<div class='fe-row-name'><a rel='" + this.RelativePath + "' href='javascript:void(0)'>" + this.Name + "</a></div>";
            html += "<div class='fe-row-size'>" + this.SizeString + "</div>";
            html += "<div class='fe-row-permission'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<div class='visible'></div>") + (this.IsReadOnly ? "" : "<div class='editable'></div>") + "</div>";
            html += "</div>";
        });
        html += "</div>";
        html += "</div>";
        return html;
    }

    this.getMiniInfo = function () {
        var html = "<strong>" + lang.sub_folder + "：</strong>" + folderObj.FolderCount + " | <strong>" + lang.sub_file + "：</strong>" + folderObj.FileCount;
        return html;
    }

    this.getInfo = function () {
        var html = "";
        html += "<ul class='fe-form'>";
        html += "<li><label>" + lang.folder + "</label>" + folderObj.Name + "</li>";
        html += "<li class='split'></li>";
        html += "<li><label>" + lang.file_path + "</label>" + folderObj.Path + "</li>";
        html += "<input class='fe-propertypath' type='hidden' value='" + folderObj.RelativePath + "'/>";
        //html += "<li><label>" + lang.file_size + "</label>" + folderObj.SizeString + "(" + folderObj.Size + " "+ lang.bytes +")</li>";
        html += "<li><label>" + lang.sub_file + "</label>" + folderObj.FileCount + "</li>";
        html += "<li><label>" + lang.sub_folder + "</label>" + folderObj.FolderCount + "</li>";
        html += "<li class='split'></li>";
        html += "<li><label>" + lang.file_created + "</label>" + folderObj.CreatedString + "</li>";
        html += "<li><label>" + lang.file_last_updated + "</label>" + folderObj.LastModifiedString + "</li>";
        html += "<li><label>" + lang.file_last_visited + "</label>" + folderObj.LastAccessedString + "</li>";
        html += "<li class='split'></li>";
        html += "<li><label>" + lang.read_only + "</label><input class='fe-isreadonly' type='checkbox' " + (folderObj.IsReadOnly ? "checked='checked'" : "") + "/> " + lang.read_only_explain + "</li>";
        html += "<li><label>" + lang.hidden + "</label><input class='fe-ishidden' type='checkbox' " + (folderObj.IsHidden ? "checked='checked'" : "") + "/> " + lang.hidden_explain + "</li>";
        html += "<li><label>" + lang.system + "</label><input class='fe-issystem' type='checkbox' " + (folderObj.IsSystem ? "checked='checked'" : "") + "/></li>";
        html += "<li><label>" + lang.archive + "</label><input class='fe-isarchive' type='checkbox' " + (folderObj.IsArchive ? "checked='checked'" : "") + "/></li>";
        html += "<li class='split'></li>";
        html += "<li><label>" + lang.writable + "</label><input class='fe-app-iswritable' type='checkbox' " + (folderObj.IsWritable ? "checked='checked'" : "") + "/> " + lang.writable_explain + "</li>";
        html += "<li><label>" + lang.readable + "</label><input class='fe-app-isbrowsable' type='checkbox' " + (folderObj.IsBrowsable ? "checked='checked'" : "") + "/> " + lang.readable_explain + "</li>";
        html += "</ul>";
        html += folderObj.Permission;
        return html;
    }
}
//课题组共享文件列表
function generateShareTable(shareFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='60%' align='center'>" + lang.file_name + "</th><th width='5%' align='center'>" + lang.file_permission + "</th><th width='10%' align='left'> " + lang.SPACE_Sharer + " <input type='button' title=" + lang.sort + " onclick=sort('user') class='sorttype'></th><th width='10%' align='center'>" + lang.SPACE_SharingDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(shareFiles, function () {
        html += "<tr class='fe-file row' rel='" + this.FILE_NAME + "'>";
        html += "<td><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;' href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' onclick='prePerSinglefile(" + this.FILE_ID + ")' class='visible'></input>") + "</td>";
        html += "<td align='center'>" + this.USER_NAME + "</td>";
        html += "<td align='center'>" + this.CREATE_TIME + "</td>";
        
        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}


function selectalldata() {
    for (i = 0; i < document.getElementsByName("cks").length; i++) {
        if (document.getElementsByName("ckalldata")[0].checked) {
            document.getElementsByName("cks")[i].checked = true;
        }
        else {
            document.getElementsByName("cks")[i].checked = false;
        }
    }
}

//修改元数据
function file_editsourcefiles() {

    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    relativePath = str;
    var strs = str.split(',');
    var strlength = strs.length;
     if (strlength > 1) {
        box.alert(lang.error, lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }
    if (g_sSpaceType == "individual") {
        box.open_window(lang.SPACE_Space_modify_metadata, fe_url + "/DataSubmit/EditSourceFiles2.aspx?path=" + str + "&filename=&spacetype=individual", 760, 520, true);
    }
    else if (g_sSpaceType == "group") {
        box.open_window(lang.SPACE_Space_modify_metadata, fe_url + "/DataSubmit/EditSourceFiles2.aspx?path=" + str + "&filename=&spacetype=group", 760, 520, true);
    }
    else if (g_sSpaceType == "project") {
        box.open_window(lang.SPACE_Space_modify_metadata, fe_url + "/DataSubmit/EditSourceFiles2.aspx?path=" + str + "&filename=&spacetype=project", 760, 520, true);
    }
 }

//批量共享数据
function file_sharedatas(is_click)
{
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    relativePath = str;
    var strs = str.split(',');
    var strlength = strs.length;



    box.open_window(lang.SPACE_File_Sharing_, fe_url + "/ShareFile/FileShare.aspx?path=" + escape(relativePath) + "&filename=''", 420, 420, true);

 }


function file_renames(path, newname, g_sSpaceType, is_click) {
    /*重命名开始*/
    var html = "<ul class='fe-form'>";
    html += "<li><label></label></li>";
    html += "<li>"+lang.There_is_already_a_file_with_the_same_name_whether_to_rename+"</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        if (newname) {
            var renameUrl = "RenameDatas";
            var data = "{ IDS:'" + path + "', newName:'" + newname + "',SpaceType:'" + g_sSpaceType + "'}";
            filemanager.post(renameUrl, data,is_click, function (d) {
                if (d.d.success) {
                    box.alert(lang.success, d.d.message);
                    filemanager.reload();
                    $(this_box).wijdialog("close"); 
                                        
                } else {
                    box.error(d.d.message);
                }
            });
        } else {
            box.error(lang.file_name_cannot_be_null);
        }

    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };


    box.dialog(lang.rename + name, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 220,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });


}
//批量重命名数据
function file_renamedatas(is_click) {
    
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    relativePath = str;
    var strs = str.split(',');
    var strlength = strs.length;
    
    if (strlength > 1) {
        box.alert(lang.error,lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }



    /*重命名开始*/

    var filename = [];
    filename = filemanager.get_selected_name().split('.');

    var filepath = filemanager.get_selected_name();
    var names = filepath.split("\\");
    var pos = names[names.length - 1].lastIndexOf(".");
    var FileExt = names[names.length - 1].substring(0, pos);

    var index1=filepath.lastIndexOf(".");
    var index2=filepath.length;
    var result = filepath.substring(index1, index2); //后缀名
    

    var html = "<ul class='fe-form'>";
    html += "<li><label>" + lang.new_name + "</label><input class='fe-newname' type='text' value='" + FileExt + "' /><input class='fe-result' type='hidden' value='" + result + "' /></li>";
    html += "<li class='split'></li>";
    html += "<input class='fe-newnamepath' type='hidden' value='" + relativePath + "'/>";
    html += "<li><label>" + lang.original_name + "</label>" + filemanager.get_selected_name() + "</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var newname = $(this).find(".fe-newname").val();
        var result = $(this).find(".fe-result").val();
        newname = newname + result;
        var path = $(this).find(".fe-newnamepath").val();
        //alert(path);
        var this_box = this;
        //判断是否有同名文件
        var data = "{ IDS:'" + path + "', newName:'" + newname + "',SpaceType:'" + g_sSpaceType + "'}";
        filemanager.post("ConfirmHaveSameFile", data, is_click, function (d) {
            if (d.d.success) {
                if (newname) {
                    //alert(wjtype);
                    var renameUrl = "RenameDatas";

                    var data = "{ IDS:'" + path + "', newName:'" + newname + "',SpaceType:'" + g_sSpaceType + "'}";
                    filemanager.post(renameUrl, data, is_click, function (d) {
                        if (d.d.success) {
                            box.alert(lang.success, d.d.message);
                            filemanager.reload();
                            $(this_box).wijdialog("close");
                        } else {
                            box.error(d.d.message);
                        }
                    });
                } else {
                    box.error(lang.file_name_cannot_be_null);
                }

            } else {
                file_renames(path, newname, g_sSpaceType); //确定后提交
            }
        });

    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };


    box.dialog(lang.rename + name, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 220,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });

    /*重命名结束*/
}


//批量移动数据
function file_movedatas(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    /*移动开始*/

    var count = 1; // filemanager.get_selected_count();

    if (count > 0) {
        var count = 1; // filemanager.get_selected_count();
        var selected = filemanager.get_selected();
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {

                var newpath = $(this).find(".fe-newpath").val();
                if (newpath == '' || newpath == undefined || newpath == null) {
                    box.alert("提示", "请选择文件夹");
                    return;
                }
                var url = "CutDatas";

                var this_box = this;
                var folderId;
                filemanager.post(url, "{ IDS:'" + str + "', newIDS:'~/" + newpath + "',SpaceType:'" + g_sSpaceType + "' }", is_click, function (d) {
                    if (d.d.success) {
                        folderId = d.d.data;
                        box.alert(lang.copy + lang.success, d.d.message);
                    } else {
                        box.error(d.d.message);
                    }
                    $(this_box).wijdialog("close");


                    filemanager.reload();

                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + lang.move + lang.the_following_file_to + "：<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'></strong><br/>";
            html += "<div class='container_id' style=' margin-left:25px' >";
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + lang.move, html, {
                autoOpen: true,
                modal: true,
                width: 520,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }

            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }

    /*移动结束*/
}


//批量复制数据
function file_copydatas(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    /*复制开始*/

    var count = 1;// filemanager.get_selected_count();
    
    if (count > 0) {
        var count = 1; // filemanager.get_selected_count();
        var selected = filemanager.get_selected();
        if (count > 0) {
            var buttons = {};
            buttons[lang.confirm] = function () {

                var newpath = $(this).find(".fe-newpath").val();
                if (newpath == '' || newpath == undefined || newpath == null) {
                    box.alert("提示","请选择文件夹");
                    return;
                }
                var url = "CopyDatas";

                var this_box = this;
                var folderId;
                filemanager.post(url, "{ IDS:'" + str + "', newIDS:'~/" + newpath + "',SpaceType:'" + g_sSpaceType + "' }", is_click, function (d) {
                    if (d.d.success) {
                        folderId = d.d.data;
                        box.alert(lang.copy + lang.success, d.d.message);
                    } else {
                        box.error(d.d.message);
                    }
                    $(this_box).wijdialog("close");


                    filemanager.reload();

                });
            };

            buttons[lang.cancel] = function () {
                $(this).wijdialog("close");
            };

            var html = "<div class='fe-notes'>";
            html += "<strong>" + lang.are_you_sure + lang.move + lang.the_following_file_to + "：<input type='textbox'  class='fe-newpath1'/><input type='hidden' class='fe-newpath'></strong><br/>"
            html += "<div class='container_id' style=' margin-left:25px' >"
            html += "</div>";
            html += "</div>";
            var box_id = box.dialog_tree(lang.confirm + " " + lang.move, html, {
                autoOpen: true,
                modal: true,
                width: 520,
                buttons: buttons,
                captionButtons: {
                    pin: { visible: false },
                    refresh: { visible: false },
                    toggle: { visible: false },
                    minimize: { visible: false },
                    maximize: { visible: false }
                }

            });
        } else {
            box.error(lang.tips_select_file_folder_name);
        }
    } else {
        box.error(lang.tips_select_file_folder_name);
    }

/*复制结束*/
}

//批量下载
function DownLoaddatas(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    relativePath = str;
    var strs = str.split(',');
    var strlength = strs.length;

    
    //filemanager.downloadByClick(str);
    //filemanager.compress();
    filemanager.downloaddatas(str);
}


//批量提交
function Submitdatas(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    var spaceType = $("#hiddenType_Name_IsAdmin").val();
    var spacename = $("#hiddenSpace_Name").val();
     if (spaceType) {
         spaceType = spaceType.split('|');
         //个人空间提交课题组
         if (spaceType[0] == "individual") {
             var user_id = getCookie('_userId_');
             var attr = "{ user_id:'" + user_id + "'}";

             filemanager.post("GetTeamData", attr, true, function (d) {
                 var html = "<ul style='list-style-type:none'>";
                 //                 html += "<li>" + lang.confirm + "</li>";
                 $.each(d.d, function () {
                     //alert(this.TEAM_ID);
                     html += "<li> <input type='checkbox' name='teamck' value='" + this.TEAM_ID + "'  />" + this.TEAM_NAME + "</li>";
                 });
                 html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
                 html += "</ul>";



                 var buttons = {};
                 buttons[lang.confirm] = function () {
                     var strteam = "";
                     var inputsteam = document.getElementsByTagName("INPUT");
                     for (var i = 0; i < inputsteam.length; i++) {
                         if (inputsteam[i].type == 'checkbox') {
                             if (inputsteam[i].name == "teamck") {
                                 if (inputsteam[i].checked == true) {
                                     strteam += inputs[i].value + ",";
                                     inputs[i].checked = false;
                                 }
                             }
                         }
                     }
                     if (strteam == "") {
                         box.alert(lang.error, lang.SPACE_No_data);
                         return;
                     }
                     var this_box = this;
                     var data = "{ FILE_ID:'" + str.toString() + " ',TEAM_ID:'" + strteam.toString() + "',spaceType:'individual',SpaceName:'" + spacename.toString() + "'}";
                     strteam = "";
                     filemanager.post("DatasToBubmit", data, is_click, function (d) {
                         if (d.d.success) {
                             filemanager.reload(); //成功之后刷新
                             $(this_box).wijdialog("close");
                             filemanager.reload();
                             box.alert(lang.SPACE_Tips, d.d.message);
                         } else {
                             box.error(d.d.message);
                         }
                     });

                 };
                 buttons[lang.cancel] = function () {
                     $(this).wijdialog("close");
                 };
                 box.dialog(lang.confirm + lang.submit, html, {
                     autoOpen: true,
                     modal: true,
                     width: 400,
                     height: 290,
                     buttons: buttons,
                     captionButtons: {
                         pin: { visible: false },
                         refresh: { visible: false },
                         toggle: { visible: false },
                         minimize: { visible: false },
                         maximize: { visible: false }
                     }
                 });
             });
         }
         //课题组提交项目库
         else if (spaceType[0] == "group") {
             var html = "<ul style='list-style-type:none'>";
             html += "<li>" + lang.SPACE_These_documents_submitted_to_the_project_library + "</li>";
             html += "<li class='split'><br /></li>";
             html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
             html += "</ul>";

             var user_id = getCookie('_userId_');
             var buttons = {};
             buttons[lang.confirm] = function () {
                 var this_box = this;
                 var data = "{ FILE_ID:'" + str.toString() + " ',TEAM_ID:'',spaceType:'group',SpaceName:'" + spacename.toString() + "'}";
                 filemanager.post("DatasToBubmit", data, is_click, function (d) {
                     if (d.d.success) {
                         filemanager.reload(); //成功之后刷新
                         $(this_box).wijdialog("close");
                         filemanager.reload();
                     } else {
                         box.error(d.d.message);
                     }
                 });
             };
             buttons[lang.cancel] = function () {
                 $(this).wijdialog("close");
             };

             box.dialog(lang.confirm, html, {
                 autoOpen: true,
                 modal: true,
                 width: 400,
                 height: 190,
                 buttons: buttons,
                 captionButtons: {
                     pin: { visible: false },
                     refresh: { visible: false },
                     toggle: { visible: false },
                     minimize: { visible: false },
                     maximize: { visible: false }
                 }
             });
         }
     }

}

//文件重命名-先判断是否有同名文件
function RenameSameFile(is_click) {
   
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul>";
    html += "<li>" + lang.SPACE_Move_files_to_the_recycle_bin + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var user_id = getCookie('_userId_');
    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
        filemanager.post("DatasToRestoreFile", data, is_click, function (d) {
            if (d.d.success) {
                filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                filemanager.reload();
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.del, html, {
        autoOpen: true,
        modal: true,
        width: 400,
        height: 190,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });


}

//将文件移动到回收站
function GetSelectFieldsdata(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }

    var html = "<ul>";
    html += "<li>" + lang.SPACE_Move_files_to_the_recycle_bin + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" +lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var user_id = getCookie('_userId_');
    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var data = "{ FILE_ID:'" + str.toString() + " ',SpaceType:'" + g_sSpaceType + "'}";
        filemanager.post("DatasToRestoreFile", data, is_click, function (d) {
            if (d.d.success) {
                filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                filemanager.reload();
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.del, html, {
        autoOpen: true,
        modal: true,
        width: 400,
        height: 190,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });


}
//项目库共享文件列表
function generateXmkShareTable(shareFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='60%' align='center'>" + lang.file_name + "</th><th width='5%' align='center'>" + lang.file_permission + "</th><th width='10%' align='center'> " + lang.SPACE_Sharer + "<input type='button' title=" + lang.sort + "  onclick=sort('user') class='sorttype'></th><th width='10%' align='center'>" + lang.SPACE_SharingDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";

    html += "<tbody id='directory-content-list'>";
    $.each(shareFiles, function () {
        html += "<tr class='fe-file row' rel='" + this.FILE_NAME + "'>";
        html += "<td><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' onclick='prePerSinglefile(" + this.FILE_ID + ")' class='visible'></input>") + "</td>";
        html += "<td align='center'>" + this.USER_NAME + "</td>";
        html += "<td align='center'>" + this.CREATE_TIME + "</td>";
        
        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}


//个人空间我的共享文件列表
function generateMyShareTable(shareFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='3%' align='center'><input type='checkbox' name='ckperall' onchange='selectperall()' /></th><th width='63%' align='center'>" + lang.file_name + "</th><th width='10%' align='center'>&nbsp;<input type='button' title=" + lang.preview + " onclick='prePerCheckfile()' class='visible'>&nbsp;&nbsp;</input><input type='button' title=" + lang.SPACE_Unshare + " onclick='CancelShareFile()' class='back'></input></th><th width='15%' align='center'>" + lang.SPACE_Space_name_ + "<input type='button' title=" + lang.sort + " onclick=sort('space') class='sorttype'></th><th width='12%' align='center'>" + lang.SPACE_SharingDate + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>";
    html += "</thead>";

    html += "<tbody id='directory-content-list'>";
    var spaceType = "Person";
    $.each(shareFiles, function () {
        html += "<tr class='fe-file row' rel='" + this.FILE_NAME + "'>";
        html += "<td  align='center'><input type='checkbox'  name='ck_per' value='" + this.FILE_ID + ";" + this.SHARE_OBJ_ID + "' /></td>";
        html += "<td><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
        //        html += "<td align='center'><input type='button' onclick='showSharefile(" + this.FILE_ID + ")' class='visible'></input></td>";
        html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "") + "</td>";
        html += "<td align='center'>" + this.SHARE_OBJ_NAME + "</td>";
//        html += "<td align='center'>" + this.UPD_TIME + "</td>";
        html += "<td align='center'>" + this.CREATE_TIME + "</td>";
        
        //html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' title=" + lang.preview + " onclick='showfile1(" + this.FILE_ID + ")' class='visible'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Resubmit_ + " onclick='ResetSubmit(" + this.FILE_ID + ")' class='uponelevel'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Cancel + " onclick='BackSubmit(" + this.FILE_ID + ")' class='back'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_View_a_single_receipt_ + " onclick='MyReceipt(" + this.FILE_ID + ")' class='thumb'></input>") + "</td>";
        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

///取消共享
function CancelShareFile(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_per") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }

    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    var user_id = getCookie('_userId_');
    var html = "<ul>";
    html += "<li>" + lang.SPACE_Other_people_will_not_be_able_to_access_this_file_sharing + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "<li class='split'></li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var spaceType = "Person";
        var data = "{ FILE_ID:'" + str + " ',SpaceType:'" + spaceType.toString() + "'}";
        filemanager.post("CancelShareFile", data, is_click, function (d) {
            if (d.d.success) {
                filemanager.reload(); //成功之后刷新
                // box.alert(lang.success, d.d.message);
                filemanager.load_shareMyView(user_id);
                $(this_box).wijdialog("close");
                
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Unshare, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });

}

//个人空间我的提交列表
function getMySubmitDataTable(shareFiles) {
    var html = "<table class='directory-content'>";
    html += "<thead>";
    html += "<tr><th width='60%' align='center'>" + lang.file_name + "</th><th width='5%' align='center'>" + lang.file_permission + "</th><th width='20% 'align='center'>" + lang.SPACE_Submit_research_group + "<input type='button' title=" + lang.sort + " onclick=sort('space') class='sorttype'></th><th width='15%' align='center'>" + lang.SPACE_Submit_time + "<input type='button' title=" + lang.sort + " onclick=sort('time') class='sorttype'></th></tr>"; //<th width='10%' align='center'>" + lang.SPACE_State + "</th></tr>";
    html += "</thead>";
    html += "<tbody id='directory-content-list'>";
    $.each(shareFiles, function () {
        html += "<tr class='fe-file row'  rel='" + this.FILE_NAME + "'>";
        html += "<td  align='center'><a style='padding-left:20px; background:url(images\/ico\/exttype\/" + this.Type + ") no-repeat;'  href='javascript:void(0)'>" + this.FILE_NAME + "</a></td>";
//        if (this.STATSU == "已审核") {
            html += "<td align='center'><input type='button' title=" + lang.preview + " onclick='preTeamSinglefile(" + this.FILE_ID + ")' class='visible'></input></td>";
//        }
//        else if (this.STATSU == "未审核") {
//            html += "<td align='center'><input type='button' title=" + lang.preview + " onclick='prePerSinglefile(" + this.FILE_ID + ")' class='visible'></input></td>";
//        }
//        else if (this.STATSU == "已退回") {
//            html += "<td align='center'>" + (this.IsHidden ? "<div class='invisible'></div>" : "<input type='button' title=" + lang.preview + " onclick='showfile1(" + this.FILE_ID + ")' class='visible'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Resubmit_ + " onclick='ResetSubmit(" + this.FILE_ID + ")' class='uponelevel'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_Cancel + " onclick='BackSubmit(" + this.FILE_ID + ")' class='back'></input>&nbsp;&nbsp;<input type='button' title=" + lang.SPACE_View_a_single_receipt_ + " onclick='MyReceipt(" + this.FILE_ID + ")' class='thumb'></input>") + "</td>";
//        }
        html += "<td align='center'>" + this.TEAM_NAME + "</td>";
        var myDate = new String(this.CREATE_TIME);
        html += "<td align='center'>" + myDate.split(" ", 1) + "</td>";
      //  html += "<td align='center'>" + this.STATSU + "</td>";
        
        html += "</tr>";
    });
    html += "</tbody>";
    html += "</table>";
    return html;
}

//重新提交
function ResetSubmit(id) {


    box.open_window(lang.SPACE_Resubmit_, "DataSubmit/AgainDataSubmit.aspx?File_ID=" + id + "&FileSpace_Type=Team", 743, 355, true);
}
//放弃提交
function BackSubmit(id, is_click) {
    var html = "<ul>";
    html += "<li>" + lang.SPACE_Records_and_files_will_be_deleted_after_cancel + "</li>";
    html += "<li class='split'></li>";
    html += "<li>" + lang.SPACE_Are_you_sure + "</li>";
    html += "</ul>";

    var buttons = {};
    buttons[lang.confirm] = function () {
        var this_box = this;
        var spaceType = "Person";
        var data = "{ FILE_ID:'" + id.toString() + " '}";
        filemanager.post("BackFile", data, is_click, function (d) {
            if (d.d.success) {
                //filemanager.reload(); //成功之后刷新
                $(this_box).wijdialog("close");
                var user_id = getCookie('_userId_');
                filemanager.load_MySubmitData(user_id);
            } else {
                box.error(d.d.message);
            }
        });
    };
    buttons[lang.cancel] = function () {
        $(this).wijdialog("close");
    };

    box.dialog(lang.SPACE_Cancel, html, {
        autoOpen: true,
        modal: true,
        width: 500,
        height: 180,
        buttons: buttons,
        captionButtons: {
            pin: { visible: false },
            refresh: { visible: false },
            toggle: { visible: false },
            minimize: { visible: false },
            maximize: { visible: false }
        }
    });
}

//查看回执
function MyReceipt(id) {
    box.open_window(lang.SPACE_View_a_single_receipt_, "DataSubmit/MyReceipt.aspx?File_ID=" + id + "&FileSpace_Type=Team", 400, 300, true);
}


//**************在线预览**************************//
//个人空间单个文件预览
function prePerSinglefile(id, is_click) {
    //    box.open_window("", "DataViewShow/DataViewShow1.aspx?File_ID=" + id + "&FileSpace_Type=Team", 1040, 700, true);
    filemanager.post("PerHasSWF1", "{ File_ID:'" + id + "'}", is_click, function (d) {
        if (d.d) {
//            filemanager.post("getFile_Ext", "{ File_ID:'" + id + "',FileSpace_Type:'Personal'}", is_click, function (d) {
//                //获取返回的字符串，包括文件夹名称和文件夹ID
//                var File_Ext = d.d;
                box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + id + "&space_type=10", 1030, 650, true);
               
//            });
        } else {
            box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
        }
    });

}
//课题组单个文件预览
function preTeamSinglefile(id, is_click) {
    //    box.open_window("", "DataViewShow/DataViewShow1.aspx?File_ID=" + id + "&FileSpace_Type=Team", 1040, 700, true);
    filemanager.post("TeamHasSWF1", "{ File_ID:'" + id + "'}", is_click, function (d) {
        if (d.d) {
//            filemanager.post("getFile_Ext", "{ File_ID:'" + id + "',FileSpace_Type:'Team'}", is_click, function (d) {
//                //获取返回的字符串，包括文件夹名称和文件夹ID
//                var File_Ext = d.d;
                box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + id + "&space_type=20", 1030, 650, true);
                
//            });
        } else {
            box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
        }
    });

}
//项目库单个文件预览
function preXmkSinglefile(id, is_click) {
    filemanager.post("XMKHasSWF1", "{ File_ID:'" + id + "'}", is_click, function (d) {
        if (d.d) {
//            filemanager.post("getFile_Ext", "{ File_ID:'" + id + "',FileSpace_Type:'project'}", is_click, function (d) {
//                //获取返回的字符串，包括文件夹名称和文件夹ID
//                var File_Ext = d.d;
                box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + id + "&space_type=30", 1030, 650, true);
//            });
        } else {
            box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
        }
    });

}
//个人空间复选框预览
function prePerCheckfile(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_per") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }

    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    var strs = str.split(',');
    var strlength = strs.length;

    if (strlength > 1) {
        box.alert(lang.error, lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }
    if (str.lastIndexOf(";") > 0) {
        //去除共享中value中多余字符
        str = str.substring(0, str.lastIndexOf(";"));
    }
    filemanager.post("PerHasSWF1", "{ File_ID:'" + str + "'}", is_click, function (d) {
        if (d.d) {
//            filemanager.post("getFile_Ext", "{ File_ID:'" + str + "',FileSpace_Type:'Personal'}", is_click, function (d) {
//                //获取返回的字符串，包括文件夹名称和文件夹ID
//                var File_Ext = d.d;
            box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + str + "&space_type=10", 1030, 650, true);
//            });

        } else {
            box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
        }
    });
}

//课题组复选框预览
function preTeamCheckfile(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_team") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    var strs = str.split(',');
    var strlength = strs.length;

    if (strlength > 1) {
        box.alert(lang.error, lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }
    filemanager.post("TeamHasSWF1", "{ File_ID:'" + str + "'}", is_click, function (d) {
        if (d.d) {
//            filemanager.post("getFile_Ext", "{ File_ID:'" + str + "',FileSpace_Type:'Team'}", is_click, function (d) {
//                //获取返回的字符串，包括文件夹名称和文件夹ID
//                var File_Ext = d.d;
            box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + str + "&space_type=20", 1030, 650, true);
//            });

        } else {
            box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
        }
    });
}



//项目库复选框预览
function preXmkCheckfile(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_xmk") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    var strs = str.split(',');
    var strlength = strs.length;

    if (strlength > 1) {
        box.alert(lang.error, lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }
    filemanager.post("XMKHasSWF1", "{ File_ID:'" + str + "'}", is_click, function (d) {
        if (d.d) {
//            filemanager.post("getFile_Ext", "{ File_ID:'" + str + "',FileSpace_Type:'project'}", is_click, function (d) {
//                //获取返回的字符串，包括文件夹名称和文件夹ID
//                var File_Ext = d.d;
            box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + str + "&space_type=30", 1030, 650, true);
//            });
        } else {
            box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
        }
    });
}

//三个空间文件列表在线预览
function file_onlineshow(is_click) {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "cks") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
    relativePath = str;
    var strs = str.split(',');
    var strlength = strs.length;

    if (strlength > 1) {
        box.alert(lang.error, lang.SPACE_The_current_view_to_select_more_than_one_file);
        return;
    }
    if (g_sSpaceType == "individual") {


        filemanager.post("PerHasSWF1", "{ File_ID:'" + str + "'}", is_click, function (d) {
            if (d.d) {
//                filemanager.post("getFile_Ext", "{ File_ID:'" + str + "',FileSpace_Type:'individual'}", is_click, function (d) {
//                    //获取返回的字符串，包括文件夹名称和文件夹ID
//                    var File_Ext = d.d;
                    box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + str + "&space_type=10", 1030, 650, true);
//                });
            } else {
                box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
            }
        });
    }
    else if (g_sSpaceType == "group") {

        filemanager.post("TeamHasSWF1", "{ File_ID:'" + str + "'}", is_click, function (d) {
            if (d.d) {
//                filemanager.post("getFile_Ext", "{ File_ID:'" + str + "',FileSpace_Type:'Team'}", is_click, function (d) {
//                    //获取返回的字符串，包括文件夹名称和文件夹ID
//                    var File_Ext = d.d;
                    box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + str + "&space_type=20", 1030, 650, true);
//                });
            } else {
                box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
            }
        });
    }
    else if (g_sSpaceType == "project") { 
        filemanager.post("XMKHasSWF1", "{ File_ID:'" + str + "'}", is_click, function (d) {
            if (d.d) {
//                filemanager.post("getFile_Ext", "{ File_ID:'" + str + "',FileSpace_Type:'project'}", is_click, function (d) {
//                    //获取返回的字符串，包括文件夹名称和文件夹ID
//                    var File_Ext = d.d;
                    box.open_window("", "../Views/DataSearch/WatchViewHander.aspx?id=" + str + "&space_type=30", 1030, 650, true);
//                });
            } else {
                box.alert(lang.SPACE_Tips, lang.SPACE_The_document_is_temporarily_not_generating_preview_or_preview_file_is_missing);
            }
        });
    }
}

//*****************在线预览结束******************//

//课题组批量退回
function BackFile() {
    var str = "";
    var inputs = document.getElementsByTagName("INPUT");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == 'checkbox') {
            if (inputs[i].name == "ck_team") {
                if (inputs[i].checked == true) {
                    str += inputs[i].value + ",";
                }
            }
        }
    }
    if (str == "") {
        box.alert(lang.error, lang.SPACE_No_data);
        return;
    }
    str = str.substring(0, str.length - 1);
   
    box.open_window(lang.SPACE_Return, "UnauditedData/BackFile.aspx?File_ID=" + str + "&FileSpace_Type=Team", 600, 220, true);
}
//通过
function MoveFile(id) {
    box.open_window(lang.SPACE_Through, "UnauditedData/MoveFile.aspx?File_ID=" + id + "", 800, 600, true);
}

//文件列表的导航条高度 2011-10-12 xiaobiqin
//Some UI fix
$(function () {



    var Resize = function () {
        //alert($(window).height());
        var i = (($(window).height()) - 230);
        //alert(i);
        if (i >= 5000) {
            $(".directory-content").height("500px");
            //alert($(".directory-content").height(i));
        } else {
            // $(".directory-content").height(i);
        }

    }
    if (document.all) {
        window.attachEvent("onscroll", function () { Resize(); });
        window.attachEvent("onresize", function () { Resize(); });
    } else {
        window.addEventListener("scroll", function () { Resize(); }, true);
        window.addEventListener("resize", function () { Resize(); }, true);
    }
    Resize();
});
